I had always assumed that the first entry in sys.path
by default was the current working directory. But as it turns out, on my system the first entry is the path on which the script resides. So if I'm executing a script that's in /usr/bin
from /some/directory
, the first entry in sys.path
is /usr/bin
. Is something misconfigured on my system, or is this the expected behavior?
views:
82answers:
2
+4
A:
This is by design:
As initialized upon program startup, the first item of this list,
path[0]
, is the directory containing the script that was used to invoke the Python interpreter.
Yuval A
2009-11-12 15:14:25
I understand that. I was just somewhat dumbfounded when celery wasn't able to find the celeryconfig file in the current directory. :-)
Jason Baker
2009-11-12 15:20:01