Andre,

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')    
# 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'


------------------------------------------------------------------------------
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

Reply via email to