do export statement in Python script

Simon Strobl Simon.Strobl at gmail.com
Wed Oct 22 07:19:29 EDT 2008


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?

Simon



More information about the Python-list mailing list