1) The file is LaTeX 2) the % means LaTeX will ignore it. 3) The question was about using pythontex with LaTeX 4) I included the file so you (OK, others) could see what I was trying 5) The problem had to do with accessing a file name within the python script using \py{outputfile} 6) pythontex is a terrific package that I enjoy using 7) I was looking for help on debugging this error. 8) I was trying to find out why I could not do \py{outfilename}
On Sunday, September 22, 2013 7:58:59 PM UTC-5, Steven D'Aprano wrote: > I don't usually top post, but for this I'll make an exception because I > > have *no idea* what any of your post means. > > > > Are you actually asking a question? I can't see a question mark in it, so > > there's no explicit question. Are you just sharing something interesting > > you have learned? Expecting us to read your mind and intuit what the > > question is? > > > > Why do nearly, but not quite all, the lines in your post start with % or > > \ or sometimes both? It looks like Postscript rather than Python. > > > > Perhaps you should try again, and this time don't assume that we're > > familiar with whatever it is you're doing. Remember to include natural > > language explaining what your problem is, what result you expected, what > > result you actually got. In this forum, use English please. This is > > *especially* critical if using an unusual technology that most people are > > not familiar with. > > > > I strongly recommend that first you read this: > > > > http://sscce.org/ > > > > Its written for Java developers, but the same basic principles apply for > > Python. Remember that the number one language you should be using for > > communication is natural language (English in this forum) and code only > > second. > > > > Thank you. > > > > > > Steve > > > > On Sun, 22 Sep 2013 13:26:06 -0700, chitturk wrote: > > > > > \documentclass[12pt]{article} > > > \usepackage{graphicx} > > > \usepackage{wrapfig} % Allows in-line images \usepackage{pythontex} > > > \setpythontexworkingdir{.} > > > \begin{document} > > > > > > This is an example of using pythontex > > > > > > \begin{pycode} > > > > > > import pylab as p > > > import numpy as np > > > x = np.linspace(0.0,1.0,10) > > > y = 2.0*x + 5.0 > > > xmax = max(x) > > > ymax = max(y) > > > p.plot(x,y) > > > outputfile = 'myplot.png' > > > p.savefig(outputfile) > > > p.clf() > > > > > > \end{pycode} > > > > > > % this works fine, I can print the name of the output file, variables > > > > > > The plot is named \py{outputfile}, the max in x was \py{xmax} and > > > \py{ymax} > > > > > > % now I would like to plot it, this works > > > > > > \includegraphics[scale=0.75]{myplot.png} > > > > > > % but when I do this > > > > > > %\includegraphics[scale=0.75]{\py{outputfile}} > > > > > > % I get > > > > > > %! File ended while scanning definition of \filename@base. %<inserted > > > text> > > > % } > > > % no pdf > > > > > > > > > > > > \end{document} -- https://mail.python.org/mailman/listinfo/python-list