environment (simple)
os is mac, editor is atom, language is python, code execution is atom-runner
what someone is doing
Importing googlemaps into python and using google's Geocoding API trying to get latitude and longitude from the address.
problem
The code works fine and you can get the information you want from googlemaps.
However, it only works with the first code execution after atom is started.
For some reason, code execution after the second time will fail with an error.
After the first code execution is complete, the following error will appear when the code is re-executed.
Traceback (most recent call last):
File"/************/test_geocode.py", line 1, in <module>
import googlemaps
ModuleNotFoundError: No module named 'googlemaps'
After that, no matter how many times you try, you will only get the same error above.
However, you can restart atom and retrieve information only during the first run.
Code Affected
import googlemaps
googleapikey='My API_KEY'
gmaps=googlemaps.Client(key=googleapikey)
result=gmaps.geocode('Any Address')
lat=result[0]["geometry"]["location"]["lat"]
lng=result[0]["geometry"]["location"]["lng"]
print(result)
print(lat,lng)
The code should be correct as described in the "Problem" section above
Tried
pip install wheel
(I tried it because there was information on the Internet, but it didn't change)pip uninstall googlemaps
and I found information about the same error (No module named 'googlemaps'), but I couldn't find information about the same symptom.
Environment Details
The cause was an atom-runner in the package used to execute code.
I changed the code execution package from atom-runner to script and it was resolved.
atom-runner had to be uninstalled.
If atom-runner is still installed, script will experience the same symptom.
(The reason is unknown)
https://qiita.com/akira_ak/questions/a44579fe3b6201cabfba#answer-c647db82f30ff02a7c22
598 Uncaught (inpromise) Error on Electron: An object could not be cloned
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
877 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
576 PHP ssh2_scp_send fails to send files as intended
595 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.