I am trying to run nosetest using tipfy and google app engine but I keep getting an import error:
From the google_appengine directory I execute the following command (directory contains dev_appserver.py):
nosetests /Users/me/Documents/python/project/ --with-gae --without-sandbox
but I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 8, in <module>
load_entry_point('nose==0.11.4', 'console_scripts', 'nosetests')()
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/core.py", line 117, in __init__
**extra_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 816, in __init__
self.parseArgs(argv)
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/core.py", line 134, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/config.py", line 323, in configure
self.plugins.configure(options, self)
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/plugins/manager.py", line 270, in configure
cfg(options, config)
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/plugins/manager.py", line 93, in __call__
return self.call(*arg, **kw)
File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/plugins/manager.py", line 161, in simple
result = meth(*arg, **kw)
File "build/bdist.macosx-10.6-universal/egg/nosegae.py", line 84, in configure
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 51, in <module>
import fancy_urllib
ImportError: No module named fancy_urllib
I can load the tipfy hello_world project without any errors and I have other app engine projects on the same machine, all running fine.
Using a mac os x 10.6.6 and I have both nose and nosegae installed. I have also tried to execute the same command from within the /Users/me/Documents/python/project/ folder but I get the same result
It turns out that it is because of a UI bug when you set up the "Python Path" in the Preferences of GoogleAppengineLuncher. It needs an Enter to confirm the setting:
Then set the "Python Path" to
Enter to confirm
See here
I also ran into this problem using Nose / NoseGAE. I had no luck with trying various
--gae-lib-root
values, but I did eventually have luck patchingdev_appserver.py
(located in/usr/local/google_appengine/google/appengine/tools/
in my MacOS install) as follows:This closely follows some code in
appcfg.py
(fix_sys_paths()
) mentioned in GAE issue ticket #3597. I suspect the issue lies in how Nose sets up the execution path, although I can't prove so at the moment.Try to run it with option:
and please show Python sys.path.
Nowadays (2016) GAE Python recommends loading the project libraries in the file at the root level entitled "appengine_config.py".
Thus, if you are still facing some obnoxious issues, pls make sure to also add the os dir path to load the library folder "lib" (as can be seen in my code below):
After I did the above, I was able to run my tests successfully from IntelliJ (PyCharm). Furthermore, please notice my test settings setup on intelliJ (PyCharm)
Hope the above can help some Python GAE devs since I had some challenges in getting the NoseGAE simple setup to work. Take care!
If you are running stand alone scripts then before using any appengine stuff you gotta link to dirs
I had the same problem and here is my quick fix:
Modify this file "/usr/local/bin/dev_appserver.py"
Works for me so far.