[Grok-dev] Grokserver scripts using a different path than python's console

Hector Blanco white.lists at gmail.com
Wed Dec 15 11:23:29 EST 2010


[ UPDATE ]
Oh, I've seen why this is happening: In my server folder, bootstrap.py
said this:
(around the line 44):
# In order to be more robust in the face of system Pythons, we want to
# run without site-packages loaded.  This is somewhat tricky, in
# particular because Python 2.6's distutils imports site, so starting
# with the -S flag is not sufficient.  However, we'll start with that:

I went to the bin/paster script, and changed the first line from:
#!/usr/bin/python2.6 -S

to #!/usr/bin/python2.6

and there it was... all the eggs under /usr/local/lib/python2.6/dist-packages/

but then I couldn't start the server, because I got an exception:
--------------------------------
  File "/usr/local/lib/python2.6/dist-packages/zope.configuration-3.7.2-py2.6.egg/zope/configuration/xmlconfig.py",
line 431, in openInOrPlain
    fp = open(filename)
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File
"/home/ae/invue-cms/server/parts/etc/site.zcml", line 4.2-4.30
    IOError: [Errno 2] No such file or directory:
'/usr/local/lib/python2.6/dist-packages/server-0.0-py2.6.egg/server/configure.zcml'
--------------------------------

Does anyone know what is the right way to handle this? My guess is
that if grokserver developers used the -S to start with a "clean"
path, there must be a reason, but then, I don't know how to install
external packages (such as MySQLdb that comes in a .tar.gz file)

Thank you!





2010/12/15 Hector Blanco <white.lists at gmail.com>:
> Hello everyone... I just tried to install the latest version of
> grokserver (1.2.1) but for some reason the PATH the scripts to install
> and start the server differ for the path the regular python console
> uses.
>
> I created a "server" project under "$HOME/myown-cms/" using:
> $ grokproject server
> (no sudo)
>
> It worked fine, everything was installed and the server started working.
>
> Then I manually installed the MySQL-python-1.2.3.tar.gz package which
> installs its .egg under /usr/local/lib/python2.6/dist-packages/
>
> And when I tried to use it in my grokserver application, I got a nasty
> exception: ImportError: No module named MySQLdb. If I open a python
> console I can properly import MySQLdb.
>
> I studied the version and the path both console and the grok-scripts
> under server/bin/ are using, and I got this:
>
> In bin/paster:
> ---------------------------------------------------------------
> /usr/bin/python2.6
> /home/ae/myown-cms/server/parts/app
> /home/ae/myown-cms/server/bin
> /usr/lib/python2.6
> /usr/lib/python2.6/plat-linux2
> /usr/lib/python2.6/lib-tk
> /usr/lib/python2.6/lib-old
> /usr/lib/python2.6/lib-dynload
> /home/ae/myown-cms/server/src
> /home/ae/.buildout/eggs/z3c.evalexception-2.0-py2.6.egg
> /home/ae/.buildout/eggs/Paste-1.7.5.1-py2.6.egg
> /home/ae/.buildout/eggs/setuptools-0.6c11-py2.6.egg
> /home/ae/.buildout/eggs/PasteScript-1.7.3-py2.6.egg
> /home/ae/.buildout/eggs/PasteDeploy-1.3.4-py2.6.egg
> /home/ae/.buildout/eggs/zope.security-3.7.4-py2.6-linux-i686.egg
> /home/ae/.buildout/eggs/grokcore.startup-1.1-py2.6.egg
>
> [ . . . A LOT OF OTHER EGGS IN $HOME/.buildout/eggs . . . ]
>
> /home/ae/.buildout/eggs/mechanize-0.2.3-py2.6.egg
> /home/ae/.buildout/eggs/zope.minmax-1.1.2-py2.6.egg
> /home/ae/.buildout/eggs/zope.tal-3.5.2-py2.6.egg
> /home/ae/.buildout/eggs/RestrictedPython-3.6.0-py2.6.egg
> /home/ae/.buildout/eggs/zope.datetime-3.4.0-py2.6.egg
> /home/ae/.buildout/eggs/zope.testing-3.10.0-py2.6.egg
> ---------------------------------------------------------------
>
>
> For the console:
> ---------------------------------------------------------------
> ae at ae-desktop:~$ python
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.executable
> '/usr/bin/python'
> (just a link to /usr/bin/python2.6, same thing the paster script)
>>>> for pth in sys.path:
> ...     print pth
> ...
>
> /usr/local/lib/python2.6/dist-packages/grokproject-2.2-py2.6.egg
> /usr/local/lib/python2.6/dist-packages/lxml-2.3beta1-py2.6-linux-i686.egg
> /usr/local/lib/python2.6/dist-packages/hashlib-20081119-py2.6-linux-i686.egg
> /usr/local/lib/python2.6/dist-packages/feedparser-4.1-py2.6.egg
>
> [ . . . A LOT OF OTHER EGGS IN /usr/local/lib/python2.6/dist-packages/ . . . ]
>
> /usr/local/lib/python2.6/dist-packages/zope.copy-3.5.0-py2.6.egg
> /usr/local/lib/python2.6/dist-packages/zope.testing-3.10.0-py2.6.egg
> /usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3-py2.6-linux-i686.egg
> /usr/lib/python2.6
> /usr/lib/python2.6/plat-linux2
> /usr/lib/python2.6/lib-tk
> /usr/lib/python2.6/lib-old
> /usr/lib/python2.6/lib-dynload
> /usr/lib/python2.6/dist-packages
> /usr/lib/python2.6/dist-packages/PIL
> /usr/lib/python2.6/dist-packages/gst-0.10
> /var/lib/python-support/python2.6
> /usr/lib/python2.6/dist-packages/gtk-2.0
> /var/lib/python-support/python2.6/gtk-2.0
> /usr/local/lib/python2.6/dist-packages
> ---------------------------------------------------------------
>
> The Path information under /usr/local/lib/python2.6/dist-packages/
> that appears with the console doesn't appear in the paster script, and
> I don't know why... Do I have to install the grokserver being root?
>
> I have another instance of grokserver running with python2.4, and I
> was able to import the module MySQLdb there. I read that I could be
> having this kind of trouble for having two different python versions,
> but I'm not really sure if this problem is caused for that or not.
>
> Any hint will be deeply appreciated. Thank you in advance
>


More information about the Grok-dev mailing list