Re: [Twisted-Python] what is a non-class class?

2014-09-03 Thread Glyph
On Sep 2, 2014, at 11:45 PM, Wolfgang Rohdewald wrote: > I still do not like "non-class class" because this is a contradiction > in itself. How about "non-class found in class slot when deserializing method object"? > Anyway a non-class class is a class whose objects may not get a > method a

Re: [Twisted-Python] what is a non-class class?

2014-09-03 Thread Wolfgang Rohdewald
Am Mittwoch, 3. September 2014, 00:29:59 schrieb Glyph: > > That is my problem. How do I know if the object is of a non-class class? > > isinstance(something, (types.ClassType, type)). but that will make it possible to attach a method even to type "int" Python2: >>> isinstance(int, type) True

[Twisted-Python] Return only when value/handle is available

2014-09-03 Thread vikas kumar
Hi, I am little new to twisted. I've a function(get_handle) which returns a handle. But get_handle() may throw an exception(SystemDelayException) because of some delay in system. My requirement is : When I get SystemDelayException re-attempt get_handle() and return only when handle is availabl

Re: [Twisted-Python] Return only when value/handle is available

2014-09-03 Thread Jonas Brunsgaard
I would fiddle around with something like this. from twisted.internet.defer import inlineCallbacks, returnValue, Deferred from twisted.internet import reactor @inlineCallbacks def foo(self, retries=10, interval=10): while True: try: returnValue((yield self.get_handle()))

Re: [Twisted-Python] Return only when value/handle is available

2014-09-03 Thread Adi Roiban
One option in which we have both reactor and deferred :) def do_low_level_stuff(deferred) try: deferred.callback(self.get_handle()) except SystemDelayException: reactor.callLater(1, do_low_level_stuff, deferred) def do_stuff(): deferred = Deferred() do_low_level_st

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread Justin Mazzola Paluska
On 09/02/2014 09:50 AM, exar...@twistedmatrix.com wrote: I dig deeper and I found out that since I was using reactor.run(installSignalHandlers=False) _SIGCHLDWaker was not installed. I have switched to using just reactor.run() and the process is now killed. Without my workaround, I continu

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread Adi Roiban
On 2 September 2014 14:50, wrote: > On 01:38 pm, j...@editshare.com wrote: >> [snip] >> >> Without my workaround, I continue to have the problem with the >> gtk2reactor. > > Have you reported this bug? > > Jean-Paul In my initial use case, signal handlers were not installed since I wanted a cust

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread exarkun
On 01:05 pm, a...@roiban.ro wrote: On 2 September 2014 14:50, wrote: On 01:38 pm, j...@editshare.com wrote: [snip] Without my workaround, I continue to have the problem with the gtk2reactor. Have you reported this bug? Jean-Paul In my initial use case, signal handlers were not instal

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread Adi Roiban
On 3 September 2014 14:39, wrote: > On 01:05 pm, a...@roiban.ro wrote: >> >> On 2 September 2014 14:50, wrote: >>> >>> On 01:38 pm, j...@editshare.com wrote: >> [snip] Without my workaround, I continue to have the problem with the gtk2reactor. >>> >>> >>> Have you

[Twisted-Python] spawnProcess with timeout and same error handling on Unix and Windows

2014-09-03 Thread Adi Roiban
Hi, If I call spawnProcess with a bad executable, on Unix the process will exit with exit code 1 while on Windows an OSError is raised. I am working on a multi-OS software and to make my life easier I ended up with this hack inspired by _BackRelay https://gist.github.com/adiroiban/bac493f00ce5e9

Re: [Twisted-Python] spawnProcess with timeout and same error handling on Unix and Windows

2014-09-03 Thread exarkun
On 03:49 pm, a...@roiban.ro wrote: Hi, If I call spawnProcess with a bad executable, on Unix the process will exit with exit code 1 while on Windows an OSError is raised. Ideally, these two implementations of the same interface would have the same error behavior in this case. In other words,

Re: [Twisted-Python] spawnProcess with timeout and same error handling on Unix and Windows

2014-09-03 Thread Adi Roiban
On 3 September 2014 16:49, Adi Roiban wrote: > Hi, > > If I call spawnProcess with a bad executable, on Unix the process will > exit with exit code 1 while on Windows an OSError is raised. > > I am working on a multi-OS software and to make my life easier I ended > up with this hack inspired by _B

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread Adi Roiban
Just for reference: For the gkt2 reactor problem I found this bug report https://twistedmatrix.com/trac/ticket/5289 ... I guess that there is a problem with gtk2 and spawnProcess On 3 September 2014 16:27, Adi Roiban wrote: > On 3 September 2014 14:39, wrote: >> On 01:05 pm, a...@roiban.ro wrot

Re: [Twisted-Python] Return only when value/handle is available

2014-09-03 Thread vikas kumar
Hi Jonas, This is nice. But still we are retrying it repeatedly at regular interval(10). Can't we get the notified asynchronously as and when handle is available. Regards Vikas On 9/3/2014 6:10 PM, Jonas Brunsgaard wrote: I would fiddle around with something like this. from twisted.internet

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread exarkun
On 03:27 pm, a...@roiban.ro wrote: On 3 September 2014 14:39, wrote: Yes. Providing more fine-grain control over signal handlers would be a fine improvement. Do you have any suggestion for how the calls should be made? reactor.run(installSignalHandlers=True, installStopHandlers=False)

Re: [Twisted-Python] spawnProcess - reapProcess not retrying on failures

2014-09-03 Thread exarkun
On 05:55 pm, exar...@twistedmatrix.com wrote: Gtk messes with signals too. There are confusing order-of-execution dependencies and Gtk changes subtly from release to release, re- breaking things after we fix them or changing them to be broken in a different way. So that's *why* it probably

Re: [Twisted-Python] spawnProcess with timeout and same error handling on Unix and Windows

2014-09-03 Thread exarkun
On 05:17 pm, a...@roiban.ro wrote: On 3 September 2014 16:49, Adi Roiban wrote: Hi, If I call spawnProcess with a bad executable, on Unix the process will exit with exit code 1 while on Windows an OSError is raised. I am working on a multi-OS software and to make my life easier I ended up wit

Re: [Twisted-Python] Return only when value/handle is available

2014-09-03 Thread exarkun
On 05:52 pm, vikas.c.ku...@oracle.com wrote: Hi Jonas, This is nice. But still we are retrying it repeatedly at regular interval(10). Can't we get the notified asynchronously as and when handle is available. You tell us. What's a handle? Where do you get it from? Does that system produce

Re: [Twisted-Python] what is a non-class class?

2014-09-03 Thread Glyph Lefkowitz
On Sep 3, 2014, at 12:55 AM, Wolfgang Rohdewald wrote: > Am Mittwoch, 3. September 2014, 00:29:59 schrieb Glyph: >>> That is my problem. How do I know if the object is of a non-class class? >> >> isinstance(something, (types.ClassType, type)). > > but that will make it possible to attach a me