0
I’m having a hard time.
i have a code in Selenium(test.py) and I have another python queue code (Queue.py) my goal is to pass the error message [ error = {'Status': 'Error'} ] to the result(Queue.py)
test py.
def run():
try:
driver = webdriver.Firefox()
driver.get('https://www.google.com')
elem = driver.find_element_by_name('q')
elem.send_keys()
elem.send_keys(Keys.RETURN)
except:
error = {'Status': 'Error'}
dados = json.loads(error)
Quepy.
It’s just a piece of code.
import pika
import json
def worker(ch, method, properties, body):
print("\tBody: %r" % body)
try:
data = json.loads(body)
print(data['nome'])
import teste
result{
"Status_de_error" : dados['Status']
}
but the file (Queue.py) returns me the following error.
global name 'data' is not defined
Obs : both files are in the same folder
Can someone please help me???