sys.path vs os.environ['POST']

Scott David Daniels scott.daniels at acm.org
Thu May 22 11:27:19 EDT 2003


Achim Domma wrote:
> .... In my __init__.py I will do something like this:
> 
> import sys,os
> from os.path import split, join
> path = join(split(__file__)[0],'DLLs')
> sys.path.append(path)
> os.environ['PATH'] += ";"+path
> 
> Is that ok, or is there something bad with modifying sys.path and
> os.environ['PATH'] in an __init__.py?

You might want to check that this path is not already on the
the list (so if you have app.pth files, you don't increase your work).:
	...
	if path not in sys.path:
		...





More information about the Python-list mailing list