Wednesday, 18 September 2013

Pydev can't compile turbogears quickstart

Pydev can't compile turbogears quickstart

I'm very new to python, pydev and turbogears.
I've installed these relevant packages into my virtualenv with pip
$ pip list backlash (0.0.3) Beaker (1.6.4) cliff (1.4.4) cmd2 (0.6.5.1)
crank (0.6.4) decorator (3.4.0) gearbox (0.0.2) Mako (0.9.0) MarkupSafe
(0.18) PasteDeploy (1.5.0) prettytable (0.7.2) pyparsing (1.5.7)
repoze.lru (0.6) SQLAlchemy (0.8.2) Tempita (0.5.1) tg.devtools (2.3.0)
transaction (1.4.1) TurboGears2 (2.3.0) WebOb (1.2.3) WebTest (1.4.3)
wsgiref (0.1.2) zope.interface (4.0.5) zope.sqlalchemy (0.7.2)
I then create a new turbogears2 project with sqlalchemy using:
$ gearbox quickstart -s -m testproject
Within Pydev (version 2.7.4), I do
File -> New -> Pydev Project
I select the pathname of the "testproject" project I just created. I
choose the python interperter which I've already setup in Pydev which
refers to my virtualenv above.
Now the issue...
If I choose the option "Create 'src' folder and add it to PYTHONPATH?",
then all is well.
If I choose the option "Add project directory to PYTHONPATH?", I
immediately get compile errors within my project, which is nothing more
than a fresh scaffold provided by turbogears quickstart, unedited by me.
As an example, the file
testproject/testproject/model/init.py will not compile, this line:
from zope.sqlalchemy import ZopeTransactionExtension
produces the error:
Unresolved import: ZopeTransactionExtension
However, if I go outside Pydev, and create test.py with a single line
from zope.sqlalchemy import ZopeTransactionExtension
this test.py compiles cleanly outside of Pydev. This makes me think
turbogears/sqlalchemy setup is not the issue.
I can also see ZopeTransactionExtension defined within
lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py (imported from
init.py) under my virtualenv
Why does is Pydev happy when src folder exists but not in the latter case?
Since it works in the first case, I'm pretty sure my interpreter is setup
correctly within Pydev.

No comments:

Post a Comment