WebFaction
Community site: login faq

As the doc on http://docs.webfaction.com/software/python.html#python-search-path explain on executin pythonX.Y on apps folder, the dir apps/lib/pythonX.Y should be included on the sys.path.

But when I run:

[***@web319 django14]$ python2.7 -c "import sys; print sys.path"

I Get:

['', '/home/***/lib/python2.7/pip-1.2.1-py2.7.egg', '/home/***/lib/python2.7', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages/PIL']

django14 is a webfaction app, the folder lib/pythonX.Y exists with several modules installed by:

pip-X.Y install --install-option="--install-scripts=$PWD/bin" --install-option="--install-lib=$PWD/lib/pythonX.Y" package

how can I debug this?

asked 26 Feb '13, 19:57

Mariano a
112
accept rate: 0%


When you run a Python command with "python2.7 -c ...", Python does not pick up global site customizations (from sitecustomize.py), so our Python search path magic doesn't happen as expected.

It should still work if you invoke a full interpreter, or if you execute Python script files, from a working directory at or below your app directory.

If you have some pressing need to run commands with "python2.7 -c ..." then, as a workaround, you can set the PYTHONPATH environment variable when you run the command, eg:

PYTHONPATH=$HOME/webapps/my_app/lib/python2.7 python2.7 -c "import sys; print sys.path"

Hope that helps!

permanent link

answered 27 Feb '13, 16:03

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×54
×4

question asked: 26 Feb '13, 19:57

question was seen: 1,823 times

last updated: 27 Feb '13, 16:03

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM