File opening

Mark McEahern marklists at mceahern.com
Wed Apr 3 16:35:09 EST 2002


[Salim Zayat]
> But if you wanna import the module, then the path to the open statement 
> needs to be full path to the file.  Is there a fix to this?

Put it in a package and use __path__.

Consider:

/site-packages/
  /a/
	__init__.py

# __init__.py
pass

This means you can do this:

import a
print a.__path__[0]

// mark





More information about the Python-list mailing list