1

I want to upload a text file present in a folder of raspberry pi. For this I have used the following code:

from pydrive.drive import GoogleDrive
drive = GoogleDrive(gauth)

file1 = drive.CreateFile({'title': 'Hello.txt'})  # Create GoogleDriveFile instance with title 'Hello.txt'.
file1.SetContentString('Hello World!') # Set content of the file from given string.
file1.Upload()

running this code in raspberry pi I'm getting the following errors:

 Traceback (most recent call last):   File "uploadfile3.py", line 1, in <module>
    from pydrive.drive import GoogleDrive   File "/usr/local/lib/python2.7/dist-packages/pydrive/drive.py", line 2, in <module>
    from .files import GoogleDriveFile   File "/usr/local/lib/python2.7/dist-packages/pydrive/files.py", line 12, in <module>
    from .auth import LoadAuth   File "/usr/local/lib/python2.7/dist-packages/pydrive/auth.py", line 9, in <module>
    from oauth2client.service_account import ServiceAccountCredentials   File "/usr/local/lib/python2.7/dist-packages/oauth2client/service_account.py", line 26, in <module>
    from oauth2client import crypt   File "/usr/local/lib/python2.7/dist-packages/oauth2client/crypt.py", line 23, in <module>
    from oauth2client import _pure_python_crypt   File "/usr/local/lib/python2.7/dist-packages/oauth2client/_pure_python_crypt.py", line 24, in <module>
    from pyasn1_modules.rfc2459 import Certificate   File "/usr/local/lib/python2.7/dist-packages/pyasn1_modules/rfc2459.py", line 20, in <module>
    from pyasn1.type import opentype ImportError: cannot import name opentype

Please help me to remove this error. And if there's some other way to upload the text file then please help me out with it.

Sugandha
  • 59
  • 7

1 Answers1

2

See https://github.com/etingof/pyasn1-modules/issues/10, I suspect this has to do with oauth2client's deprecation and the releases of pyasn1 and pyasn1-modules on 11/23/17.