from __future__ import division
import sys, time, os.path, magic
import atom.data, gdata.client, gdata.docs.client, gdata.docs.data
The complete code is at http://planzero.org/blog/2012/04/13/uploading_any_file_to_google_docs_with_python
I am working in Ubuntu 14.04 on virtualbox. I am using Python 2.7.6. I have both the atom and the gdata modules installed successfully with latest versions. But my code gives me the following error while importing the modules.
Traceback (most recent call last):
File "test14.py", line 16, in <module>
import atom.data, gdata.client, gdata.docs.client, gdata.docs.data
File "/usr/local/lib/python2.7/dist-packages/atom/data.py", line 24, in <module>
import atom.core
ImportError: No module named core
I also tried to import the entire atom module instead.
import atom, gdata.client, gdata.docs.client, gdata.docs.data
Gives the following error:
Traceback (most recent call last):
File "test14.py", line 16, in <module>
import atom, gdata.client, gdata.docs.client, gdata.docs.data
File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 35, in <module>
import atom.client
File "/usr/local/lib/python2.7/dist-packages/atom/client.py", line 27, in <module>
import atom.http_core
ImportError: No module named http_core
Both core.py and http_core.py are present at /usr/local/lib/python2.7/dist-packages/atom/. I tried directly importing these modules
import atom.http_core, atom.core
It worked. So what is going wrong?
Here is something that worked for me. Not a solution I would go for if I had a choice, but it did work!
First I copied atom and gdata directories from
/usr/local/lib/python2.7/dist-packages
to my working directory. I did this because it made editing any files easier. Python looked for the import modules first in the working directory. And I got permissions on the copied directories and files. Plus I retain the original copy in the original location.Next I edited the data.py file from atom. I changed the import statement from
import atom.core
toimport core
.Next I edited the client.py file from atom. I changed the import statement from
import atom.http_core
toimport http_core
.This seemed to be working as I didn't get any errors at these points anymore. Now I realized that in both of the above instances, import statement tried to import the module as atom.module from inside the atom package. So then I proceeded to change all the instances where
atom.module
was used in the above files to justmodule
. The code ran fine.