Unresolved import in pydev

2019-07-30 03:00发布

I am a first time user of Python, I have Eclipse (Helios) on Windows XP and Pydev installed and all is well except that when I am following the GAE tutorial for Python

I get the unresolved import error on run_wsgi_app and webapp from from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app

The code runs fine. I have looked for an answer and added

F:\Program Files\Google\google_appengine\google\appengine\ext and

F:\Program Files\Google\google_appengine\google\appengine\ext\webapp

to be sure to my PYTHONPATH via the Eclipse Python Interpreter interface. I have removed and re-added the interpreter, pressed Apply, restarted Eclipse but all to no avail.

I am posting this as I am sure many new users with GAE + Python + Eclipse + Pydev would have the same problem.

Regards, Chris

3条回答
地球回转人心会变
2楼-- · 2019-07-30 03:37

Add the package parent directory (the first directory with a init.py file)

F:\Program Files\Google\google_appengine

to the PYTHONPATH in Eclipse under the 'External Libraries' tab.

Also beware of a bug in PyDev that does not respect/understand Python namespaces (as opposed to packages). For more info see:

http://sourceforge.net/tracker/index.php?func=detail&aid=3284882&group_id=85796&atid=577329

查看更多
戒情不戒烟
3楼-- · 2019-07-30 03:48

In general, add the package's parent directory to PYTHONPATH, not the module subdirectories:

F:\Program Files\Google\google_appengine
查看更多
相关推荐>>
4楼-- · 2019-07-30 03:52

adding ${GOOGLE_APP_ENGINE}/lib/webapp2-2.5.2 to the "External Libraries" worked for me. App Engine SDK ver:1.8.2 Python version: 2.7

查看更多
登录 后发表回答