I am unable to get a Python package, gspread , to work in GAE.
My project is in D:\\Documents\\Google Cloud\\myapp
. I installed gspread
using:
c:\python27\python.exe setup.py install --home="D:\Documents\Google Cloud\myapp"
All the files appear to be installed in D:\\Documents\\Google Cloud\\myapp\\lib\\python
without offering me a choice. In fact, I have to add this path to PYTHONPATH
in order for setup.py to run properly.
If I then run Python, I can import gspread
in the interpreter.
However, in myapp, I can't import ( ImportError: No module named gspread
) even when I added that long path to sys.path
. My sys.path
at run-time contains, among other values,:
'D:\\Documents\\Google Cloud\\myapp\\lib\\python'
'D:\\Documents\\Google Cloud\\myapp'
'D:\\Documents\\Google Cloud\\myapp\\lib'
What is needed to get this third party module to work?
I got it to work by adding the following, path of a file and not a folder, to sys.path
:
D:\Documents\Google Cloud\Drive-1185\lib\python\gspread-0.2.5-py2.7.egg
A relative path may be used as the working directory is the app directory. To deploy to Google's servers, obviously only a relative path can be used, and not only that, backward slashes must be replaced with forward slashes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.