Why not set up PYTHONPATH together with other environment variables in
a shell script (bash, or CMD on Windows) and call that shell script
instead of your Python script directly?
This is probably the easiest and still a very powerful and generic
solution for this kind of problem. We do it that way
Thank you Fredrik. This is exactly what I was looking for.
> cannot you just insert the appropriate directory in sys.path the first
> thing you do in the scripts? e.g.
>
> import os, sys
>
> lib = "lib_dev" # change this for prod/rss.py
>
> sys.path.insert(0,
> os.path.j
mercado mercado wrote:
It seems that you can specify the name of the module to be imported at
runtime using the following syntax:
X = __import__('X')
(from http://effbot.org/zone/import-confusion.htm)
Of course, I would rather specify the path to the module at runtime, not
the module name i
It seems that you can specify the name of the module to be imported at
runtime using the following syntax:
X = __import__('X')
(from http://effbot.org/zone/import-confusion.htm)
Of course, I would rather specify the path to the module at runtime, not the
module name itself, but at least this is
mercado mercado wrote:
I have two versions of a script on my machine. One version is for new
development and the other version is a production version. This script
imports a module from a different directory, and this module again has
two versions (a development version and a production versi
mercado mercado wrote:
Thanks norseman for the reply.
You're right that I didn't like it though. :-)
Also note that my original question has to do with importing modules from
different locations. If all I had to do was use different paths within the
script (e.g. for sending to os.path.join o
Thanks norseman for the reply.
You're right that I didn't like it though. :-)
Also note that my original question has to do with importing modules from
different locations. If all I had to do was use different paths within the
script (e.g. for sending to os.path.join or whatever), then I could
mercado mercado wrote:
I have two versions of a script on my machine. One version is for new
development and the other version is a production version. This script
imports a module from a different directory, and this module again has two
versions (a development version and a production version)
I have two versions of a script on my machine. One version is for new
development and the other version is a production version. This script
imports a module from a different directory, and this module again has two
versions (a development version and a production version). What I want is
for the