... \usepackage{color} \usepackage{listings} \begin{document}% \lstloadlanguages{Python} \newwrite\OutputFile \openout\OutputFile=out.tex \write\OutputFile{% \begin{lstlisting}[numbers=left,name=PySource.py,commentstyle=\itshape,stringstyle=\color{blue}] import sys; class test: def __init__(self): pass; \end{lstlisting} } \end{document}
("Z:\OfficePackete\latex\MiKTeX 2.7\tex\latex\listings\lstlang1.sty"
File: lstlang1.sty 2004/09/05 1.3 listings language file
)
\OutputFile=\write4
[1
! Undefined control sequence.
\lstlisting ->\def \lstenv@name
{lstlisting}\begingroup \lst@setcatcodes \ca...
l.52 \end{document}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.