Simon Strobl wrote: > Hello, > > a program of mine, which is supposed to be used in a project, uses > nltk. I want the other users to be able to use my program without > having to fiddle around with their environment. Therefore, I tried > this code: > > #!/usr/bin/ > python > > import os > > os.system("export NLTK_DATA=/opt/nltk/data/") > > import nltk > > This doesn't work, although running "export NLTK_DATA=/opt/nltk/data/" > on the command line before running the program works. Why?
because export is a shell-command that affects only the current shell, not the parent process environment. And os.system spawns a child-process. Instead, use os.environ["NLTK_DATA"] = "/opt/nltk/data" Diez -- http://mail.python.org/mailman/listinfo/python-list