[Tutor] folder and module
Brian van den Broek
broek at cc.umanitoba.ca
Sun Sep 17 21:39:54 CEST 2006
linda.s said unto the world upon 17/09/06 02:03 PM:
<snip>
> I checked sys.path and environemntal variables:
> since the desktop directory is not listed in either of them,
> why there is no error report when I import a module which is in the
> desktop into test.py which is under a different folder?
> Linda
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
Hi Linda,
what do you get when you try:
>>> import os
>>> os.getcwd()
The current working directory is represented in sys.path as the first
element:
>>> import sys
>>> sys.path[0]
''
Not the most intuitive, perhaps.
I suspect you are launching your Python environment from a desktop
icon. That would explain why import can `see' your Desktop, even
though it doesn't at first glance seem to be in sys.path.
Best,
Brian vdB
More information about the Tutor
mailing list