I'm trying to set up an external program / lib written in python - on debian squeeze.
The error I get when I try to launch it that the "environment variable is not set" - it's an exception throw by the developer. So I guess, I have to define it, but where ?
~/.bashrc
but I'm not sure it is read in a virtualenv, and I don't want those export be read even when I don't use this virtualenv. virtualenv/bin/activate
, but it doesn't seem to work correctly.I'm trying to install Opus and Urbansim.
Here is what I get when launching:
(opus-env)touki@touki:~/Projects/opus-env$ ./src/opus_gui/opus.py
Traceback (most recent call last):
File "./src/opus_gui/opus.py", line 14, in <module>
from opus_gui.main.controllers.opus_gui_configuration import OpusGuiConfiguration
File "/home/touki/Projects/opus-test/src/opus_gui/main/controllers/opus_gui_configuration.py", line 12, in <module>
from opus_core import paths
File "/home/touki/Projects/opus-test/src/opus_core/paths.py", line 44, in <module>
OPUS_HOME = _safe_getenv('OPUS_HOME', _get_default_opus_home)
File "/home/touki/Projects/opus-test/src/opus_core/paths.py", line 33, in _safe_getenv
return os.environ[key] if key in os.environ else default_func()
File "/home/touki/Projects/opus-test/src/opus_core/paths.py", line 36, in _get_default_opus_home
raise Exception('OPUS_HOME environment variable must be set.')
Exception: OPUS_HOME environment variable must be set.
NB.: I've searched, autoenv combine virtualenvwrapper seems to provide an answer, but I would prefer not use external programs.
if you add to opus-env/bin/activate
OPUS_HOME="some value"
export OPUS_HOME
It should work (your solution 3). Of course it will not be applied to currently running processes.
Try to exit current virtualenv shell session, start new shell session, activate modified virtualenv in that new session. Before starting your program, verify environment:
env | grep OPUS_HOME
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With