On Tue, 2012-01-10 at 22:51 +0100, André Wobst wrote:
> William,
>
> Am 10.01.2012 um 18:11 schrieb William Hudspeth:
> > Thank you for your assistance on this problem. I have tried to integrate
> > your code example, and I continue to get the same error. A simplified
> > version of my code is found below, followed by the error information.
> > The code should generate a simple 2 page PDF file. I don't know what I'm
> > missing!
> >
> > 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')
>
> Could you please verify, that texunner.texruns is 0 before above this method
> call and 1 after this method call? The temporary file should have been
> created successfully at this step and the texrunner should than be able to
> process your typesetting (as long as the texrunner is not reseted, which is
> needed in some rare situations only; we'll see once we know at which step the
> exception is raised – see traceback issue below).
>
> > # but we revert the filename afterwards as it is also used to analyse
> > the
> > # output, where it occurs without the path
> > texrunner.texfilename = 'texrunner'
> >
> > document_pages=[]
> > unit.set(defaultunit="pt")
> >
> > #------------COVER PAGE (1)--------------------------------------------
> > c1 = canvas.canvas(texrunner=texrunner)
> >
> > metpics='/home/wilbur/IOM/site_media/images/metpic_combined2.jpg' # 324
> > X 324
> >
> > header_text='Meteorite Collections: Catalog'
> >
> > metpic = PIL.Image.open(metpics)
> > mx, my = metpic.size
> > bm_metpic = bitmap.bitmap(144, 280, metpic,
> > width=mx*unit.x_pt,height=my*unit.x_pt)
> >
> > #Insert bitmaps onto page
> > c1.insert(bm_metpic)
> >
> > c1.text(306, 680, header_text, [text.halign.boxcenter,
> > text.halign.center, text.size.Huge])
> >
> > p1=document.page(c1, pagename=None,
> > paperformat=document.paperformat.Letter, rotated=0, centered=0,
> > fittosize=0, margin=72 * unit.pt, bboxenlarge=1 * unit.pt, bbox=None)
> > document_pages.append(p1)
> >
> > #------------------SECOND PAGE--------------------------------------
> >
> > #Start a new page
> > c2=canvas.canvas(texrunner=texrunner)
> > c2.insert(bm_metpic)
> >
> > intro_header = "Institute of Meteoritics Meteorite Collection"
> > c2.text(306, 690, intro_header, [text.parbox(468),
> > text.halign.boxcenter, text.halign.flushleft,text.size.Large])
> > p2=document.page(c2, pagename=None,
> > paperformat=document.paperformat.Letter, rotated=0, centered=0,
> > fittosize=0, margin=72 * unit.pt, bboxenlarge=1 * unit.pt, bbox=None)
> >
> > document_pages.append(p2)
> >
> > d=document.document(pages=document_pages)
> >
> > d.writePDFfile(response)
> >
> > shutil.rmtree(tmpdir, True)
> >
> >
> >
> > --------------ERROR---------------------------
> >
> > 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. ux, uy = unm.size
> > 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'
> >
> >
> > ------------------------------------------------------------------------------
>
> There is something wrong with this traceback. Look at this line:
>
> > File "/home/wilbur/IOM/iom_catalog/views.py" in buildMetCatalog
> > 527. ux, uy = unm.size
>
>
> This can not result in the given traceback. I guess you have some old
> views.pyc file in this directory. As the directory is not writable by your
> application (which is good), the python interpreter cannot update the pyc
> file. Please remove those spurious pyc files and than the traceback will
> become meaningful.
>
> Best,
>
>
> André
>
>
After removing the pyc files, the new traceback info is as follows:
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. bm_iom = bitmap.bitmap(36, 765, iom,
width=nx*unit.x_pt,height=ny*unit.x_pt)
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: 'tmpYHNZ4b.tex'
I will work next on getting the values for texrunner.texruns...
Thanks
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user