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

Achim Domma domma at procoders.net
Wed May 21 04:46:41 EDT 2003


"Gerhard Häring" <gh at ghaering.de> wrote in message
news:mailman.1053503829.14752.python-list at python.org...
> sys.path are the directories Python searches for modules in when you try
> to import one. To see the Python import mechanism at work, you can start
> Python with "python -v" and then for example "import smtplib" at the
> interactive prompt.
>
> os.environ['PATH'] refers to the PATH environment variable, which is a
> list of directories the operating system tries to find an executable in
> if you try to start an application without an absolute or relative path,
> i. e. something like "notepad" or "ls".

Thanks, that explains the behavior and solves all my problems. I will hold
my Dlls in a subfolder of my module, called 'DLLs'. 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?

Achim






More information about the Python-list mailing list