开发者

Getting a PasteScript error when I try to serve an existing Pylons app

开发者 https://www.devze.com 2023-01-25 16:20 出处:网络
I\'m trying to serve an existing Python 2.5 Pylons application on OS X Snow Leopard. I\'ve already installed Python 2.5 and set it as the default Python installation, installed paster, and installed

I'm trying to serve an existing Python 2.5 Pylons application on OS X Snow Leopard.

I've already installed Python 2.5 and set it as the default Python installation, installed paster, and installed the version of Pylons the app needs (0.9.6.1) as well as other eggs... but when I cd to the main folder and do "paster serve development.ini" I get the following:

File "/usr/local/bin/paster", line 5, in <module>
    from pkg_resources import load_entry_point

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2603, in <module>

File开发者_开发知识库 "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 666, in require

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 565, in resolve

pkg_resources.DistributionNotFound: PasteScript==1.7.3

I definitely have done "easy_install PasteScript==1.7.3" and I still get this error. Is there something really obvious I'm missing? Help?

Thanks in advance.


You probably have multiple Python installs on your system. The easy_install command probably installed PasteScript into a different Python interpreter. You may have a specific easy_install-2.5 command that you should use instead for the Python 2.5 interpreter.

However, using virtualenv on your development system is strongly recommended.

Virtualenv allows you to create a sandbox bound to a specific Python interpreter, and where you can install specific packages versions locally based the on each project.

More information on using virtualenv with Pylons here: http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox


Perhaps this is too simple an answer, but I'd try installing to the specific version easy_install-2.5 PasteScript==1.7.3 See Easy install docs for details.


Edit first line in /usr/sbin/luci, and then add the version of python to the below line:

#!/usr/bin/python -Es

Edit first line in /usr/bin/paster and then add the version of python to the below line:

#!/usr/bin/python


I got this error even when I did "paster --help". PasteScript was in the site-packages of my virtual-env and PasteScript showed up in pip freeze. The problem was that the PasteScript folder ended in .dist-info. Another egg called distribute was installed and it was at the front of my sys.path. It had an older version of pkg_resources which did not know about ".dist-info" egg folders. The pkg_resources logic in question is in function find_on_path. You can search pkg_resources for "dist-info". So "pkg_resources.get_distribution('PasteScript')" in paste/script/command.py found no PasteScript even though it was installed. To find which pkg_resources is being used, you can run python and go "import pkg_resources; print pkg_resources". Uninstalling "distribute" fixed my current error (but then I hit another error).

Update: I was installing the latest ckan 2.6.2 (on Apr 2017) on Ubuntu precise (v12, a bit old, released in 2012-2014) (fully updated with apt-get update, installed via vagrant image ubuntu/precise64). It is broken. Using image ubuntu/trusty64 works perfectly.

0

精彩评论

暂无评论...
验证码 换一张
取 消