Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21505 > unrolled thread

Re: Launching A Truly Disjoint Process

Started byDave Angel <d@davea.name>
First post2012-03-11 17:34 -0400
Last post2012-03-11 17:34 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Launching A Truly Disjoint Process Dave Angel <d@davea.name> - 2012-03-11 17:34 -0400

#21505 — Re: Launching A Truly Disjoint Process

FromDave Angel <d@davea.name>
Date2012-03-11 17:34 -0400
SubjectRe: Launching A Truly Disjoint Process
Message-ID<mailman.573.1331501720.3037.python-list@python.org>
On 03/11/2012 05:01 PM, Ami Tavory wrote:
>    Hello,
>
>    I'm encountering a problem using the multiprocessing module to create a
> process that is truly disjoint from the parent process: i.e., one that
> contains no "memory" of the parent process, nor any record in the parent
> process that it is its child. This originated in a pygtk problem, but I'll
> try to put down as little pygtk as possible - just enough to explain the
> problem (also, sorry, but I couldn't get an answer at the gtk forum).
>
>    The code is a small python debugger front-end for GEdit. The plugin code,
> run from GEdit's process, uses
> <code>multiprocessing.Process(target = run_dbg)</code>
> to launch the debugger in a function in separate process. The debugger uses
> the bdb module like this:
> <code>bdb.run('execfile("%s")' % script)</code>.
>    This seems to work fine, except if the script being debugged is itself a
> pygtk script. Specifically, if it contains the code
> <code>Gtk.main()</code>
> then GEdit crashes with
> <error>
> [xcb] Unknown sequence number while processing queue
> [xcb] Most likely this is a multi-threaded client and XInitThreads has not
> been called
> [xcb] Aborting, sorry about that.
> gedit: ../../src/xcb_io.c:273: poll_for_event: Assertion
> `!xcb_xlib_threads_sequence_lost' failed.
> </error>
>    Googling this error yielded many results, but they all consisted of
> advice to change either the code launching the process (possibly compiling
> it differently), or change the launched process running gtk. It seems like
> gtk requires that a single thread run this. Unfortunately, in this case,
> the launching process is GEdit (whose code I cannot modify from a plugin),
> and the launched process essentially runs a hypothetical script that is
> being debugged (and whose code, therefore, is a given).
>    OTOH, clearly it is possible to run more than a single gtk app
> concurrently from completely separate processes. Is there a way, therefore,
> to launch the second process, or have the launched process do something
> when it starts, so that the two processes should essentially be disjoint?
>
>    Thanks,
>
>    Ami
>

Why not try using bash as an intermediate executable?  Have your first 
python process invoke bash, giving it the arguments to in turn launch 
the second python process.

If that won't work, then at least tell us some more of your 
environment.  What version of Python, what version of OS?

-- 

DaveA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web