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

Hector Blanco white.lists at gmail.com
Wed Dec 15 12:06:08 EST 2010


Jeeeez... I was going nuts... If you had seen the bash script I made
trying to get that working... :-D

Thank you everyone! You helped a lot!

2010/12/15 Leonardo Rochael Almeida <leorochael at gmail.com>:
> No, you should not install your dependency package under dist-packages
> before running bin/buildout.
>
> Yes, it is fetched "magically". The magic is not grokproject's, but
> comes from buildout:
>
> http://pypi.python.org/pypi/zc.buildout
>
> Which is what you executed when you ran bin/buildout.
>
> Buildout's magic comes from setuptools (or distribute), and (by
> default) fetches packages that are registered, in the Python Package
> Index (PyPI, for short):
>
> http://pypi.python.org/
>
> MySQL-python is registered on PyPI at:
>
> http://pypi.python.org/pypi/MySQL-python/
>
> And you'll notice that version 1.2.3 is the latest registered there.
>
> Cheers,
>
> Leo
>
> On Wed, Dec 15, 2010 at 17:50, Hector Blanco <white.lists at gmail.com> wrote:
>> Let me re-phrase it...
>>
>> By adding the 'mysql-python' to the install_requires in my
>> $HOME/myown-cms/server/setup.py, it works:
>>
>>      install_requires=['setuptools',
>>                        'grok',
>>                        'grokui.admin',
>>                        'z3c.testsetup',
>>                        'grokcore.startup',
>>                        # Add extra requirements here
>>                        'mysql-python'
>>
>> It properly gets
>> *************** PICKED VERSIONS ****************
>> [versions]
>> MySQL-python = 1.2.3
>>
>> *************** /PICKED VERSIONS ***************
>>
>> when I re-run bin/buildout, but I'd like to know a little bit more
>> about what happened there.
>>
>> Did the script grab the mysql-python from the version I had installed
>> under /usr/local/lib/python2.6/dist-packages/? I mean... if I want  to
>> use an external package (such as this one, where I have to download
>> the .tar.gz or another package installed with apt-get), should I
>> download the package, install it (under dist-packages/, probably) and
>> then add it to install_requires? Or does grok know where to get the
>> mysql-python package "magically"?
>>
>> Thank you!
>>
>>
>> 2010/12/15 Hector Blanco <white.lists at gmail.com>:
>>> Wow... thank you for the quick answer...
>>>
>>> I see a setup.py under my "server" folder, but that is automatically
>>> created with grokproject. Should I put it there and re-run
>>> bin/buildout?
>>>
>>> 2010/12/15 Jeffrey Peterson <bgpete at gmail.com>:
>>>> Put mysql-python in install requires in setup.py and let grokproject install it for you.
>>>>
>>>> On Dec 15, 2010, at 10:11 AM, Hector Blanco wrote:
>>>>
>>>>> 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
>>>>> _______________________________________________
>>>>> Grok-dev mailing list
>>>>> Grok-dev at zope.org
>>>>> https://mail.zope.org/mailman/listinfo/grok-dev
>>>>
>>>>
>>>
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>


More information about the Grok-dev mailing list