I am trying to auto-generate a diagram from a Python script in my Lyx document 
using the "External Material" function. I have created a Python script called 
"myscript.py" which generates a diagram and saves it to "myscript.pdf". I am 
trying to make Lyx run my script to generate the diagram when I export my 
document to PDF.

I added the following to the Lyx external_templates file:

Template Python
GuiName "Python: $$AbsOrRelPathParent$$Basename"
HelpText
Python diagram.
HelpTextEnd
InputFormat "*"
FileFilter "*.py"
AutomaticProduction true
Preview Graphics
Format PDFLaTeX
Product "\\includegraphics{$$AbsPath$$Basename.pdf}"
Requirement "graphicx"
UpdateCommand "python $$AbsPath$$Basename.py"
UpdateFormat pdf
UpdateResult "$$AbsPath$$Basename.pdf"
Requirement "graphicx"
ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
FormatEnd
TemplateEnd

However, when I insert the Python script in Lyx, it draws a box that says 
"Error converting to loadable format". If I try exporting to PDF using 
pdflatex, I get the following error:

"Missing $ inserted. Missing { inserted. I've inserted a begin-math/end-math 
symbol since I think you left one out. Proceed, with fingers crossed."

If I export to Latex using pdflatex, it seems to export correctly, and my text 
file contains something like this:

begin{document}
\includegraphics{C:/Documents and Settings/MyUsername/Desktop/myscript.pdf}
\end{document}

However, it doesn't run my update command, i.e. doesn't run the Python script. 
(I've even tried changing my update command to things like "echo test> 
output.txt" but I can't seem to get any commands to run at all.)

Any ideas what I am doing wrong? I've tried on Lyx 1.6.3 and 1.6.5-1 on Windows 
XP.

J
                                          
_________________________________________________________________
Get the latest jobs delivered. Sign up for SEEK Jobmail.
http://clk.atdmt.com/NMN/go/157639755/direct/01/

Reply via email to