On Sat, 10 Oct 2009 13:44:18 -0300, Gabriel Genellina wrote: >>> The frustrating thing, for me, is that all these requirements are met >>> if you leave the scripts in jumbled into a flat directory. >> >> I bet that's not true. I bet that they Just Work only if the user cd's >> into the directory first. In other words, if you have all your scripts >> in the directory /tools/mycompany/bin/scripts, this will work: >> >> $ cd /tools/mycompany/bin/scripts >> $ animals.py >> >> but this won't: >> >> $ cd /home/username >> $ /tools/mycompany/bin/scripts/animals.py >> >> >> In the first case, it works because the current working directory is >> included in the PYTHONPATH, and all the modules you need are there. In >> the second, it doesn't because the modules aren't in either the current >> directory or any other directory in the PYTHONPATH. >> >> That's my prediction. > > Mmm, I predict you won't have much success in your new fortune teller > career... :) > You got it backwards. At least on Windows, the current directory *isn't* > on the Python path, but the directory containing the script *is* > included. So both alternatives above work.
Oops. Serves me right for making what I thought was a sure bet before testing :) It's the same for Linux too, and it seems to hold at least back to Python 1.5. On the ignominy of it all! I guess I'll have to give up the fortune- telling and get a proper job :( -- Steven -- http://mail.python.org/mailman/listinfo/python-list