# Trouble getting started with SageTex - Please help

I'm trying and failing to use SageTex

I've added the following code to a tex document: \usepackage{sagetex}

[ \sage{2+2}. ]

and then run PDFLaTex, and indeed I get the warning: Run Sage on "Filename".sage, and then run LaTeX on "Filename".tex again

I have sagetex-2.2.5 in the installed folder of the spkg folder of my sage installation and I have sagetex.sty in my Documents folder, but when I type: run "/root/Documents/Filename.sage" into a sage terminal I get the following error message. What's wrong?

Processing Sage code for "Filename".tex...

**** Error in Sage code on line 38 of "Filename".tex! Traceback follows.
Traceback (most recent call last):
File "/root/Documents/Filename.sage", line 12, in <module>
_st_.inline(0, latex(2+2))
NameError: name 'latex' is not defined

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

SystemExit Traceback (most recent call last)

/root/Documents/Filename.sage in <module>() 12 _st_.inline(0, latex(2+2)) 13 except: ---> 14 _st_.goboom(38) 15 _st_.endofdoc() 16

/home/dcomerf/sage/local/lib/python2.6/site-packages/sagetex.py in goboom(self, line) 169 self.souttmp.close() 170 os.remove(self.filename + '.sout.tmp') --> 171 sys.exit(int(1)) 172 def endofdoc(self): 173 sagef = open(self.filename + '.sage', 'r')

SystemExit: 1 WARNING: Failure executing file: </root>

I'm sorry no one ever seems to have seen this. If you ever see this, please try again with the latest Sage and SageTeX and let us know! SageTeX is so useful, and we want it to work right for everyone. Usually there is just some configuration wrong in such situations.