2
I’m having a problem with python.
I have a python code file working with Selenium, and I have another python file working on JSON. These two codes are inside the same folder, for me to import a JSON.py file into the Selenium.py file
This is the JSON.py file
import json
def json():
dados = '{'dados_enviar': 'google.com'}'
data = json.loads(dados['dados_enviar'])
print(data)
json()
This is the Selenium.py file
from JSON import * # meu arquivo JSON.py que está na mesma pasta que o Selenium.py
import json # biblioteca nativa do python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get('https://www.google.com')
elem = driver.find_element_by_name('q')
elem.send_keys('{}'.data['dados_enviar'])
when I run the code it returns me the following error.
NameError: global name 'data' is not defined
Can someone please help me???
I had put (data = '{"process": "google.com"}' ), edited the code as you said but it returns an error for me ( Typeerror: expected string or buffer )
– user158433
i edited the function name, put ( def worker(): ), keeps giving the same error.
– user158433
edited the question in order to try to solve what you want, see if it was coherent, and if it worked!
– Absolver
OOOWW thanks guy helped a lot!!!!!!
– user158433