Hi William, we need to work around the problem that PyX originally uses tmp files at the local directory. (We did this as non-local file processing by TeX/LaTeX failed in earlier TeX/LaTeX distributions. Today, you can also commonly use output_dir and jobname command line flags, which were not present 10 years ago when we designed the TeX interface.)
I guess (and hope) the enclosed version works on your platform. It does a non-local file creation in a temporary directory. You should do that directory and texrunner setup for each request where you want to do use PyX to generate some output. Best, André Am 09.01.2012 um 18:04 schrieb William Hudspeth: > Hello Andre, > > The version I am running is listed as: > > 0.10-1ubuntu3 > > Thank you! > > > On Mon, 2012-01-09 at 17:30 +0100, André Wobst wrote: >> Hi William, >> >> are you using a released version of PyX or the current SVN head? >> >> (The background of my question is, that we might alter the text module for >> your use case as the current solution is not reliable for you. The fix would >> be rather trivial, but alters some other behavior, which people might want >> in the regular use case of running PyX scripts on the command line.) >> >> Best, >> >> >> André Wobst >> >> >> Am 09.01.2012 um 17:16 schrieb William Hudspeth: >> >>> Hello, >>> >>> I am using PyX to generate dynamic PDFs through Apache (and Django). I >>> understand that there can be issues going through Apache. Can anyone >>> point me to some actual code that will provide a work around? >>> >>> My errors: >>> >>> Environment: >>> >>> >>> Request Method: GET >>> Request URL: http://meteorite.unm.edu/buildMetCatalog/ >>> >>> Django Version: 1.3 >>> Python Version: 2.6.5 >>> Installed Applications: >>> ['django.contrib.auth', >>> 'django.contrib.contenttypes', >>> 'django.contrib.sessions', >>> 'django.contrib.sites', >>> 'cms', >>> 'cms.plugins.text', >>> 'cms.plugins.picture', >>> 'cms.plugins.link', >>> 'cms.plugins.file', >>> 'cms.plugins.snippet', >>> 'cms.plugins.googlemap', >>> 'mptt', >>> 'publisher', >>> 'menus', >>> 'iom_catalog', >>> 'django.contrib.admin', >>> 'django.contrib.admindocs', >>> 'south', >>> 'appmedia'] >>> Installed Middleware: >>> ('django.middleware.common.CommonMiddleware', >>> 'django.contrib.sessions.middleware.SessionMiddleware', >>> 'django.middleware.csrf.CsrfViewMiddleware', >>> 'django.contrib.auth.middleware.AuthenticationMiddleware', >>> 'django.contrib.messages.middleware.MessageMiddleware', >>> 'cms.middleware.page.CurrentPageMiddleware', >>> 'cms.middleware.user.CurrentUserMiddleware', >>> 'cms.middleware.toolbar.ToolbarMiddleware', >>> 'cms.middleware.media.PlaceholderMediaMiddleware') >>> >>> >>> Traceback: >>> File >>> "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in >>> get_response >>> 111. response = callback(request, >>> *callback_args, **callback_kwargs) >>> File "/home/wilbur/IOM/iom_catalog/views.py" in buildMetCatalog >>> 527. #c1.stroke(path.line(0, 4, 8, 4), [style.linewidth.THin]) >>> File "/usr/lib/pymodules/python2.6/pyx/canvas.py" in text >>> 309. return self.insert(self.texrunner.text(x, y, atext, >>> *args, **kwargs)) >>> File "/usr/lib/pymodules/python2.6/pyx/text.py" in text >>> 1190. self.execute("\\begin{document}", >>> self.defaulttexmessagesbegindoc + self.texmessagesbegindoc) >>> File "/usr/lib/pymodules/python2.6/pyx/text.py" in execute >>> 884. texfile = open("%s.tex" % self.texfilename, "w") # >>> start with filename -> creates dvi file with that name >>> >>> Exception Type: IOError at /buildMetCatalog/ >>> Exception Value: [Errno 13] Permission denied: 'tmp6Kr4AT.tex' >>> >>> >>> Thanks... >>> >>> >>> ------------------------------------------------------------------------------ >>> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex >>> infrastructure or vast IT resources to deliver seamless, secure access to >>> virtual desktops. With this all-in-one solution, easily deploy virtual >>> desktops for less than the cost of PCs and save 60% on VDI infrastructure >>> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox >>> _______________________________________________ >>> PyX-user mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/pyx-user >> > > -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) [email protected], http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
import tempfile, os.path, shutil
from pyx import *
tmpdir = tempfile.mkdtemp()
texrunner = text.texrunner()
# use the full path to open the TeX-file
texrunner.texfilename = os.path.join(tmpdir, 'texrunner')
# now we're ready to start the TeX or LaTeX process (you can do other preamble "work", too)
texrunner.preamble(r'\relax')
# but we revert the filename afterwards as it is also used to analyse the
# output, where it occurs without the path
texrunner.texfilename = 'texrunner'
c = canvas.canvas(texrunner=texrunner)
c.text(0, 0, "Hello, world!")
c.writePDFfile("hello") # you may want to write the output to the tmpdir too
shutil.rmtree(tmpdir, True)
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
