Help with os.system

Mizrandir mizrandir at hotmail.com
Sun Jun 13 22:31:03 CEST 2004


Hello, I'm a newbie with Python and there are some things I don't
understand of os.system.

I've managed to write a script that works in order to test some
things:

import os
os.system('C:\\texmf\\miktex\\bin\\latex.exe "C:\Documents and
Settings\User\Escritorio\sample2e.tex" -output-directory "C:\Documents
and Settings\User\Escritorio"')
os.startfile('C:\Documents and Settings\User\Escritorio\sample2e.dvi')

This script launches the program "latex" and passes the input and
output file names and directories. Afterwards it launches a dvi viewer
to view the output.

I have 2 questions:

Why do I have to use double \\ in C:\\texmf\\miktex\\bin\\latex.exe
(if not it does not work)? And why not in the other places?

If I have the string "C:\Documents and
Settings\User\Escritorio\sample2e.tex" stored in a variable, how could
I use it?

Thanks in advance, miz.



More information about the Python-list mailing list