Ask Your Question

Revision history [back]

sagetex's .sage file gives "runfile is not defined"

Hello,

SageTeX creates for me a .sage file. When I run Sage on that it fails, giving me an error from Python that the runfile command is not known (after apparently creating a .py file). I didn't see what I am doing wrong in the docs or by googling (sorry if I missed it). I'd be grateful for any tips about how to work around the issue. Here is the command line from a MWE.

$ sage test.sagetex.sage
Processing Sage code for test.tex...
Code block begin...
**** Error in Sage code on line 12 of test.tex! Traceback follows.
Traceback (most recent call last):
  File "test.sagetex.py", line 9, in <module>
    runfile("plot_action.sage")
NameError: name 'runfile' is not defined

**** Running Sage on test.sage failed! Fix test.tex and try again.

Here is the MWE.

\documentclass{article}
\usepackage{sagetex}

\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{sagesilent}
runfile("plot_action.sage")
p = plot_circle_action(1,0,0,1) 
p.set_axes_range(-1.5, 1.5, -0.5, 1.5) 
p.save("graphics/svd000.png",dpi=1200)
\end{sagesilent}
\lipsum[2]
\end{document}

Here is the version.

$ sage --version
Sage Version 6.1.1, Release Date: 2014-02-04

(I'm on a recent Ubuntu.)