Dear Elena, I'm sorry to tell you, that PyX as of 0.12.1 does not properly support concurrency. However, if you use different tasks (processes), the solution is rather simple: just use os.chdir to switch into a temporary directory. By that, several simultaneous PyX processes will not harm each other at all.
If you're using several threads within a single python process, the safe solution should be to create (and start) the texrunner manually for each thread generating PyX output after a chdir into a temporary directory. For this to work in a multithreaded application, you need to acquired a lock before the chdir and released it after the LaTeX interpreter startup (which can be triggered by a preamble call for example). I should note that in PyX 0.13 we've rewritten the whole TeX/LaTeX process management. It is now thread safe and you don't need to worry about temporary files etc. anymore. However, as you may know, PyX 0.13 is Python 3. Best, André Am 08.04.2014 um 12:52 schrieb Elena Molina <[email protected]>: > Hi all, > > I am working with the python library PyX (version 0.12.1). I run several > tasks at the same time in the same machine. For each task, I create a > temporary directory and remove it when the tasks are finished. > > The code I am using is as follows: > > def helloworld(tdir): > > from pyx import text,color,document,canvas,bitmap,path > > text.reset() > text.set(mode="latex") > d = document.document() > c = canvas.canvas() > c.text(0, 0, r"{\textbf{Hello World:}}", [text.size(3), > text.halign.boxleft]) > d.append(document.page(c,paperformat=document.paperformat.A4)) > d.writePDFfile(tdir + "/" + "helloworld.pdf") > > return 0 > > When I run 6 or more tasks at the same time, I have the error: "still waiting > for latex after 25 (of 60) seconds...the timeout of 60 seconds expired and > latex did not respond." How can I fix it? > > > -- > Elena Molina Molina > Senior Cloud SW Engineer in Medical Imaging at MedimSight > Phone: +34 657689202 > Email: [email protected] > +Medimsight - @MedimSight - @MedimSight_ES > > MedimSight.com > > > ------------------------------------------------------------------------------------------------------------------------- > > CONFIDENTIALITY NOTICE: This email communication may contain private, > confidential, or legally privileged information intended for the sole use of > the designated and/or duly authorized recipient(s). If you are not the > intended recipient or have received this email in error, please notify the > sender immediately by email and permanently delete all copies of this email > including all attachments without reading them. If you are the intended > recipient, secure the contents in a manner that conforms to all applicable > state and/or federal requirements related to privacy and confidentiality of > such information. > > [Spanish-Español] AVISO DE CONFIDENCIALIDAD: Este comunicación por correo > electrónico puede contener información privada, confidencial o legalmente > protegida destinada al uso exclusivo de los designados y / o debidamente > autorizados destinatario (s). Si usted no es el destinatario, o ha recibido > este mensaje por error, por favor notifique inmediatamente al remitente por > correo electrónico y elimine permanentemente todas las copias de este correo > incluyendo todos sus anexos sin leerlos. Si usted es el destinatario, asegure > el contenido de una manera que cumpla con todos los requisitos relacionados > con la privacidad y confidencialidad de dicha información estatales y / o > nacionales. > ------------------------------------------------------------------------------ > Put Bad Developers to Shame > Dominate Development with Jenkins Continuous Integration > Continuously Automate Build, Test & Deployment > Start a new project now. Try Jenkins in the cloud. > http://p.sf.net/sfu/13600_Cloudbees_______________________________________________ > 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/
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
