do export statement in Python script

Simon Strobl Simon.Strobl at gmail.com
Wed Oct 22 07:30:44 EDT 2008


On 22 Okt., 13:24, "James Mills" <prolo... at shortcircuit.net.au> wrote:
> On Wed, Oct 22, 2008 at 9:19 PM, Simon Strobl <Simon.Str... at gmail.com> wrote:
> > #!/usr/bin/
> > python
>
> > import os
>
> > os.system("export NLTK_DATA=/opt/nltk/data/")
>
> Try:
>
> os.environ["NLTK_DATA"] = "/opt/nltk/data/"
>
> if that doesn't work, consider wrapping up NLTK
> in a bash script that contains the shell statement:
> export var=...
>
> cheers
> James
>
> --
> --
> -- "Problems are solved by method"

Thanks for the answers. "os.environ["NLTK_DATA"] = "/opt/nltk/data/"
works.

Simon



More information about the Python-list mailing list