Re: [Tutor] Python development-moving from Windows to Linux (finally)

Magnus Lycka magnus at
Thu Apr 22 15:14:16 EDT 2004

> However, since I've written so many, I don't think it is really feasible
> to add 20 or more directories to my path, or to PYTHONPATH.

Don't! Modules should be in the python site-packages directory,
and your scripts should be in a directory in your PATH unless
you want to give the path when you call it. That's all there is 
to it. PYTHONPATH is only relevant if you have big systems such 
as Twisted that want to live in their own part of the file system.

> However, when I'm not in the directory where my python scripts are, I find
> that I need to add the explicit path to the python script, in order to be
> able to run it
> /home/tony/bin/

 $ /home/tony/bin/
works, but 
doesn't, I can only imagine two reasons.

1.  "/home/tony/bin/" isn't actually in your path. (Maybe the 
environment variables are confusing you. Put another program, 
such as a shell script or a compiled C program there and see 
if that works better. Do they run as expected?) 
2. Another which does something else (like nothing)
is also in your path, and is found first!

What happens if you type "which" at the $ prompt?

Erh... by the way, I hope you are typing just ""
at the $ prompt, not "python", otherwise it
doesn't matter what you set your path to. The point with the
#!-hack is that *Linux* should find out which program should
interpret the script, *not* the user!

In general, it's much easier to diagnose screen dumps than
prose, so please copy and paste more from your terminal 
window. That's less typing for you. :)


If you type "script" on a line by itself at the Linux/Unix
shell prompt, all things you type and see on the screen will
be saved in a text file called "typescript" until you type
Ctrl-D on a line of its own. That's a convenient way of
capturing the strange behaviour you run into. Then you can
pick out the juicy parts from this file and put in your email.

Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65  mailto:magnus at

More information about the Tutor mailing list