Executing a system command

jb jblazi at hotmail.com
Thu May 23 08:59:13 EDT 2002


George Demmy wrote:

> jb <jblazi at hotmail.com> writes:
> 
>> Chris Liechti wrote:
>> 
>> > jb <jblazi at hotmail.com> wrote in news:3cec0fa1_1 at news2.newsgroups.com:
>> > 
>> >> I should like to execute the bash command
>> >> 
>> >> (cd prefix;latex file.tex;dvips file)
>> >> 
>> >> Can I do that with the os.system function?
>> > 
>> > i think you can.
>> > 
>> >>It seems I am having diffculties with that.
>> > 
>> > then descibe that problem so that we can help :-)
>> 
>> I create the Latex source and when I want to compile it the Latex
>> compilation stops and an asteriks appears on the screen:
>> 
>> xxx
>> xxxxxx
>> *
>> 
>> But the latex file seems to be in order and when I do the same procedure
>> from bash, everything is in order.
>> When I execute the same command from Python, that is I have
>> os.system('(cd ...)')
>> the compilation stops.
>> 
> 
> It "can" work... I just executed a os.system command similar to yours:
> 
> os.system('cd tmp ; latex command.tex ; dvips -o foo.ps command.dvi')
> 
> and it worked fine. Do you have TeX-specific environment variables
> that may not be getting  passed to the environment in which your
> system command is executed? You can examine this environment by
> looking at os.environ. This is a dictionary keyed by the name of the
> environment variable. You can set values for the os.system environment
> simply by assignment, e.g.
> 
>>>> import os
>>>> os.environ['TEXHOME'] = '/foo'
>>>> os.system("echo $TEXHOME")

I already looked at os.environ. It contains the variable TEXINPUTS. I hope 
that this environment is passed on to the system call. How can I find out 
if there are additional variables I have to set?

-- 
Janos Blazi

"Il n'y a guère dans la vie qu'une préoccupation grave: c'est la mort;" 
(Dumas) 



-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----



More information about the Python-list mailing list