PYTHONPATH or any other way to set seachpath (winXP) ?

Sick Monkey sickcodemonkey at gmail.com
Sat Feb 3 14:55:50 EST 2007


If you need to extend your PATH variable, I have used this in the past.
<This should not require a reboot.>
~~~~~~~~~~~~~~~~~~
def AddSysPath(new_path):
        new_path = os.path.abspath(new_path)
        do = -1
        if os.path.exists(new_path):
                do = 1
                # check against all paths currently available
                for x in sys.path:
                        x = os.path.abspath(x)
                        if sys.platform == 'win32':
                                x = x.lower()
                        if new_path in (x, x + os.sep):
                                do = 0
                # add path if we don't already have it
                if do:
                        sys.path.append(new_path)
                        pass

        return do

On 2/3/07, Stef Mientki <S.Mientki-nospam at mailbox.kun.nl> wrote:
>
> Is it possible to change the searchpath for modules on the flight,
> under winXP ?
> Most preferred is some command to extend the searchpath.
> (the environment variable PYTHONPATH needs a reboot)
>
> thanks,
> Stef Mientki
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070203/4185b50e/attachment.html>


More information about the Python-list mailing list