467,877 Members | 1,150 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,877 developers. It's quick & easy.

saving path to modules permanently


Hi,

I want to create some modules to use them in my programs. Now the
problem is, how to add the path to these modules permanently to the
python search path.

For example:

import sys
sys.path.append('path to my modules')
works fine for one session but does not save this path permanently. I
also tried alreday to set the PYTHONPAHT variable to my modules but
for some reason this does not work either.

Question:
Can one add a permenent path via pathon commands (I checked already
sys, but it does not seem to have a function for this).

If not, how to do it otherwise.

It would be great to give the precise commands if someone knows how.
(BTW, I use linux)

Thanks!

Frank

Feb 16 '07 #1
  • viewed: 1179
Share:
1 Reply
Frank wrote:
Hi,

I want to create some modules to use them in my programs. Now the
problem is, how to add the path to these modules permanently to the
python search path.

For example:

import sys
sys.path.append('path to my modules')
works fine for one session but does not save this path permanently. I
also tried alreday to set the PYTHONPAHT variable to my modules but
for some reason this does not work either.

Question:
Can one add a permenent path via pathon commands (I checked already
sys, but it does not seem to have a function for this).

If not, how to do it otherwise.

It would be great to give the precise commands if someone knows how.
(BTW, I use linux)
Use

export PYTHONPATH=/path/to/module/directory

in your shell initialization file. Note that PYTHONPATH (not PYTHONPAHT)
must be an /environment/ variable, not just a shell variable.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Blog of Note: http://holdenweb.blogspot.com
See you at PyCon? http://us.pycon.org/TX2007

Feb 17 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeff Wagner | last post: by
1 post views Thread by Bengt dePaulis | last post: by
9 posts views Thread by Bengt dePaulis | last post: by
2 posts views Thread by Joseph Turian | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.