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 used to
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
Do you mean something like that?
import some_module
Traceback (most recent call last):
File stdin, 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 the obvious so often
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)
No,
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 command to
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
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 that you
Stef Mientki wrote:
Do you mean something like that?
import some_module
Traceback (most recent call last):
File stdin, 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
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 literal
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
10 matches
Mail list logo