google sheets api setup problem
djl last edited by
I successfully set up access to google spreadsheets on my laptop using the excellent guide: https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.html
It works well great on my laptop, and is a tremendous productivity tool, but when I tried to run the same script with pythonista I get the errror "no module named pyasn1.codec.der" with Python 2.7 and the error "No module named pyasn1_modules" with Python 3.6.
Is there a way to correct this? Or is there is Pythonista missing some key module?
djl last edited by
I solved my problem. All had to do was install pyasn1_modules and rsa. Now it works!
sebastianmurillo last edited by
Awesome! Care to share your code?
I am trying to pass some data generated from Shortcuts (iOS app) to pythonista and then to a Google Sheets. I have set already the Shortcuts-Pythonista part, I think, but I am still wondering whether or not to buy Pythonista for the next part.
I appreciate all the help I can get!
Hi, did you get a similar error when you moved to Python 3.x? I'm getting an error saying no module named pyasn1. Then when I go to the _python_rsa.py module I can see the error is on line 24 when it tries from pyasn1.codec.der but I can see no way around it
You need to install stash. Then you can use
pip install pyasn1-modules
Thanks Jon. I installed it via stash as suggested and did a pip list to double check which shows two pyasn1 modules installed but I’m still getting that error. Even weirder, I don’t get this error in Pythonista on the iPhone, only the iPad
[~/Documents]$ pip list
pyasn1-modules (0.2.8) - A collection of ASN.1-based protocols modules.
pyasn1 (0.4.8) - ASN.1 types and codecs
You may need to install rsa as well?
Sorry Jon. Should have included the list but got tan as well along with the following. Could some of the authlib options be conflicting with each other and leading to this error?
rsa (4.8) - Pure-Python RSA implementation
gsheet (0.0.1) - Read en excel file throgh google drive to plot a graph
oauth2client (4.1.3) - OAuth 2.0 client library
gspread (5.3.2) - Google Spreadsheets Python API
google-auth (2.6.6) - Google Authentication Library
cachetools (5.0.0) - Extensible memoizing collections and decorators
oauthlib (3.2.0) - A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
requests-oauthlib (1.3.1) - OAuthlib authentication support for Requests.
google-auth-oauthlib (0.5.1) - Google Authentication Library
What happens if you type
Into a script or console? Any errors?
Can you post your full traceback?
Sometimes it helps to delete all of your site-packages and site-packages-3 folders, except for stash, force quit, then start again. Sometimes if you have a partial install, it will both fail to import, and also fail to install again with pip.
Also, if you are running python3, make sure your launch_stash doesn't have a shebang indicating py2 -- stash should report python 3.x. if you pip with python 2, it doesn't always install the correct py3 modules.
Thank you so much Jon. I took the simple route, deleted all the modules and reinstalled. It took a couple of goes and it works. It looks like, as you say, one of the original uploads didn:t work. There are a couple of other problems but the developer who wrote the original twillo article has reached out to me so I:ll follow that route first.
Thanks again Jon