Embedding Python and program path

2009-01-15 Thread arve.knud...@gmail.com
In my application embedding Python I want to have the standard Python module path, so I try to achieve this by setting the program path to that of the the interpreter. Even though I call Py_SetProgramName before Py_InitializeEx, however, Python thinks the program path (as returned by Py_GetProgramF

Incomplete exception tracebacks when importing from zipped modules

2009-04-02 Thread arve.knud...@gmail.com
I can't seem to get complete tracebacks when modules imported from zip archives raise exceptions. For instance, consider the following module: def i_raise(): raise Exception("Test!") i_raise() When I import this module, within a .zip, from a script, I get the following traceback: Traceback (

File not closed on exception

2009-10-19 Thread arve.knud...@gmail.com
Hi I thought that file objects were supposed to be garbage-collected and automatically closed once they go out of scope, at least that's what I've been told by more merited Python programmers. I'm also quite sure that this is quite a common assumption in various programs, at least given what opens

Re: File not closed on exception

2009-10-19 Thread arve.knud...@gmail.com
On Oct 19, 3:48 pm, Ethan Furman wrote: > arve.knud...@gmail.com wrote: > > Hi > > > I thought that file objects were supposed to be garbage-collected and > > automatically closed once they go out of scope, at least that's what > > I've been told by more me

Re: File not closed on exception

2009-10-19 Thread arve.knud...@gmail.com
On Oct 19, 4:14 pm, Grant Edwards wrote: > On 2009-10-19, arve.knud...@gmail.com wrote: > > > I thought that file objects were supposed to be > > garbage-collected and automatically closed once they go out of > > scope, > > At some point after they go out of sco

Re: File not closed on exception

2009-10-19 Thread arve.knud...@gmail.com
On Oct 19, 5:56 pm, "Gabriel Genellina" wrote: > En Mon, 19 Oct 2009 09:45:49 -0200, arve.knud...@gmail.com   > escribió: > > > I thought that file objects were supposed to be garbage-collected and > > automatically closed once they go out of scope, at least th

Re: File not closed on exception

2009-10-20 Thread arve.knud...@gmail.com
On 20 Okt, 09:40, "Gabriel Genellina" wrote: > En Tue, 20 Oct 2009 03:23:49 -0300, arve.knud...@gmail.com   > escribió: > > > > > > > On Oct 19, 5:56 pm, "Gabriel Genellina" > > wrote: > >> En Mon, 19 Oct 2009 09:45:49 -0200, arve.kn

Re: File not closed on exception

2009-10-20 Thread arve.knud...@gmail.com
On 20 Okt, 16:00, Bruno Desthuilliers wrote: > What's your problem with the with ??? No problem whatsoever, but I believe I wrote this utility function before the keyword was available, and it might be good to support older Python versions. > But anyway : explicitely releasing resources such as

Re: File not closed on exception

2009-10-20 Thread arve.knud...@gmail.com
On 20 Okt, 21:13, "Gabriel Genellina" wrote: > En Tue, 20 Oct 2009 04:47:02 -0300, arve.knud...@gmail.com   > escribió: > > > On 20 Okt, 09:40, "Gabriel Genellina" wrote: > >> En Tue, 20 Oct 2009 03:23:49 -0300, arve.knud...@gmail.com   > >>

How to get directory of Python C library

2009-11-15 Thread arve.knud...@gmail.com
Hi I need to link against Python, is there a way to get the path to the directory containing Python's C library (e.g., /libs on Windows)? Thanks, Arve -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get directory of Python C library

2009-11-15 Thread arve.knud...@gmail.com
On 15 Nov, 20:05, "Diez B. Roggisch" wrote: > arve.knud...@gmail.com schrieb: > > > Hi > > > I need to link against Python, is there a way to get the path to the > > directory containing Python's C library (e.g., /libs on > > Windows)? > > Mo

Re: How to get directory of Python C library

2009-11-15 Thread arve.knud...@gmail.com
On 15 Nov, 21:24, "Diez B. Roggisch" wrote: > arve.knud...@gmail.com schrieb: > > > > > > > On 15 Nov, 20:05, "Diez B. Roggisch" wrote: > >> arve.knud...@gmail.com schrieb: > > >>> Hi > >>> I need to link against Pyt

Re: How to get directory of Python C library

2009-11-15 Thread arve.knud...@gmail.com
On 15 Nov, 22:11, "Diez B. Roggisch" wrote: > arve.knud...@gmail.com schrieb: > > > > > > > On 15 Nov, 21:24, "Diez B. Roggisch" wrote: > >> arve.knud...@gmail.com schrieb: > > >>> On 15 Nov, 20:05, "Diez B. Roggisch&quo

Re: How to get directory of Python C library

2009-11-15 Thread arve.knud...@gmail.com
On 15 Nov, 23:59, "Diez B. Roggisch" wrote: > arve.knud...@gmail.com schrieb: > > > > > > > On 15 Nov, 22:11, "Diez B. Roggisch" wrote: > >> arve.knud...@gmail.com schrieb: > > >>> On 15 Nov, 21:24, "Diez B. Roggisch"

On Windows, how do I protect arguments to shell scripts launched with subprocess?

2011-02-08 Thread arve.knud...@gmail.com
Hi Since upgrading to Python 2.7, I've run into the problem that when I launch shell scripts (.e.g, *.bat) via subprocess.Popen (with False for the 'shell' option, mind you), the arguments get interpreted by the shell. For instance, the '|' character, no longer gets passed verbatim to the script.