En Sat, 03 Feb 2007 14:25:31 -0300, Stef Mientki
<[EMAIL PROTECTED]> escribió:
> 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)
PYTHONPATH is use
> Just a note, If you run the module from different location, it may not
> always work.
>
> The '..' is relative to the location you are running the module from,
> the current directory, and not relative to the location of the module is
> at.
thanks for the tip Ron,
I didn't realized ".." was
Stef Mientki wrote:
>> Do you mean something like that?
>>
> import some_module
>> Traceback (most recent call last):
>> File "", line 1, in ?
>> ImportError: No module named some_module
> import sys
> sys.path.append("..")
> import some_module
> Rob,
> thank you very much,
> that
Inca wrote:
>> Through "My computer" | properties | advanced | Environment Variables"
>> you have to reboot.
>
> The best overall solution is the one where you modify sys.path to add
> your own custom paths,
I agree, specially in my situation that is the best solution.
however Jussi is right in
> Through "My computer" | properties | advanced | Environment Variables"
> you have to reboot.
The best overall solution is the one where you modify sys.path to add
your own custom paths, however Jussi is right in that you do not need
to reboot. You have to restart any applications that relies on
Jussi Salmela wrote:
> Stef Mientki kirjoitti:
>> Is it possible to change the searchpath for modules on the flight,
>> under winXP ?
> What do you mean by *on the flight*: inside IDLE? using the command line?
No, I run Python, embedded from within a Delphi program.
>> Most preferred is some comm
Stef Mientki kirjoitti:
> Is it possible to change the searchpath for modules on the flight,
> under winXP ?
What do you mean by *on the flight*: inside IDLE? using the command line?
> Most preferred is some command to extend the searchpath.
> (the environment variable PYTHONPATH needs a reboot)
>
> Do you mean something like that?
>
import some_module
> Traceback (most recent call last):
> File "", line 1, in ?
> ImportError: No module named some_module
import sys
sys.path.append("..")
import some_module
Rob,
thank you very much,
that's exactly what I want.
(Why is th
Stef Mientki <[EMAIL PROTECTED]> writes:
> 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)
Do you mean something like that?
>>> import some_module
If you need to extend your PATH variable, I have used this in the past.
~~
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
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
11 matches
Mail list logo