paste.script import error with Python 2.5

Bug #246199 reported by Lorenzo Gil Sanchez
4
Affects Status Importance Assigned to Milestone
zopeproject
Invalid
Undecided
Unassigned

Bug Description

I'm using Python 2.5.1 with virtualenv. After creating a project with zopeproject I tried to start the server with:

bin/paster serve deploy.ini

but got an ImportError:

Traceback (most recent call last):
  File "bin/paster", line 105, in <module>
    import paste.script.command
ImportError: No module named script.command

So I tried to manually import paste.script with no luck:

(myenv)[lgs@alh022 PasteScript-1.6.3-py2.5.egg]$ pwd
/home/lgs/proyectos/myenv/lib/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg

(myenv)[lgs@alh022 PasteScript-1.6.3-py2.5.egg]$ python -c "import paste.script"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named script

Revision history for this message
Lorenzo Gil Sanchez (lgs) wrote :
Download full text (20.5 KiB)

Further investigation tell me some relevant facts:

- Fedora 9 (my system) install python-paste rpm by default (it's a dependency for smolt)
- It does not install python-paste-deploy neither python-paste-script
- The python-paste rpm install PythonPaste as an old-school site-packages directory, not as an egg

So, in order to fix my problem I had to either:

A) yum install python-paste-deploy python-paste-script

or

B) yum remove python-paste-deploy

The real question is why the scripts living in the bin directory of my zopeproject that were created by buildout are not using Paste, PasteScript and PasteDeploy from my eggs-directory instead of the system site-packages??

Some more information that may help:

(genilenv)[lgs@alh022 demo]$ bin/python

>>> import sys
>>> from pprint import pprint
>>> pprint(sys.path)
['/home/lgs/proyectos/genil/demo/src',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.app.apidoc-3.4.3-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.app.securitypolicy-3.4.6-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/z3c.evalexception-2.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/Paste-1.7.1-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/PasteDeploy-1.3.2-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.security-3.5.1-py2.5-linux-i686.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.securitypolicy-3.4.1-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.schema-3.4.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.location-3.4.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.interface-3.4.1-py2.5-linux-i686.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.i18nmessageid-3.4.3-py2.5-linux-i686.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.i18n-3.4.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.exceptions-3.5.2-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.configuration-3.4.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.component-3.4.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.app.security-3.5.1-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.app.form-3.5.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.annotation-3.4.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.traversing-3.5.0a3-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.testing-3.5.1-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.testbrowser-3.5.0-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.publisher-3.5.3-py2.5.egg',
 '/home/lgs/proyectos/genilenv/lib/python2.5/site-packages/zope.proxy-3.4.1-py2.5-linux-i686....

Revision history for this message
Philipp von Weitershausen (philikon) wrote : Re: [Bug 246199] Re: paste.script import error with Python 2.5

El 7 Jul 2008, a las 12:33 , Lorenzo Gil Sanchez escribió:
> Further investigation tell me some relevant facts:
>
> - Fedora 9 (my system) install python-paste rpm by default (it's a
> dependency for smolt)
> - It does not install python-paste-deploy neither python-paste-script
> - The python-paste rpm install PythonPaste as an old-school site-
> packages directory, not as an egg
>
> So, in order to fix my problem I had to either:
>
> A) yum install python-paste-deploy python-paste-script
>
> or
>
> B) yum remove python-paste-deploy
>
> The real question is why the scripts living in the bin directory of my
> zopeproject that were created by buildout are not using Paste,
> PasteScript and PasteDeploy from my eggs-directory instead of the
> system
> site-packages??

That's a good question.

> I wish virtualenv/buildout/zopeproject would *really* isolate us from
> the evil system Python...

At least virtualenv can do that, you need to explicitly tell it to do
so:

   virtualenv --no-site-packages

I wish zc.buildout had a similar option, though, so that there'd be no
need for virtualenv.

Revision history for this message
Lorenzo Gil Sanchez (lgs) wrote :

Right, I didn't use --no-site-packages.

I guess that explain my mess and makes this bug as a 'works-for-me' :-)

Changed in zopeproject:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.