Running a file, with a relative filename

Nathan Clegg nathan at islanddata.com
Fri May 14 14:19:47 EDT 1999


On 14-May-99 Fredrik Lundh wrote:
> sys.path.insert(0, "../yyy")
> import prog2

I don't believe this will work unless you happen to be in the same
directory as the toplevel script.  A more bulletproof method would append
'yyy' in some way to the current sys.path[0] entry.


----------------------------------
Nathan Clegg
 nathan at islanddata.com






More information about the Python-list mailing list