where do my python files go in linux?

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Sat Jan 12 06:37:59 EST 2008


-On [20080112 12:03], Jorgen Bodde (jorgen.maillist at gmail.com) wrote:
>app.py calls a lot of modules in {dir}/app. Horst says the python file
>goes in /usr/bin/app.py which is ok with me, but I have multiple
>python files, and I decided to use an app.sh script to call my python
>files. In the /usr/bin I do not see subdirs so I assume that is not
>really desirable.

Personally I'd be loathe to put app.py in /usr/bin. This directory is normally
reserved for OS-specific binaries. For personal/system-extended stuff I'd use
/usr/local/bin or whatever your system mandates. (But hey, that's the typical
mentality difference between the BSD and Linux world it seems, so do with it
what you want.)

>Question 2. Should I use *.pyc rather then *.py files to speed up
>executing as the user cannot write to /usr/bin or any other dir in the
>system and everytime my app runs it will recompile it

.pyc will help execution time so it might be nice to have those in place.

Normally you'd split up the bulk of the code into a module which gets
installed into site-packages and a piece of stand-alone front-end code which
imports the module and executes whatever you need to do and gets installed
into a typical PATH directory.

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
...fools rush in where Angels fear to tread.



More information about the Python-list mailing list