Re: [Pyobjc-dev] using objc.inject
Brought to you by:
ronaldoussoren
From: James R E. <Jam...@lr...> - 2009-08-11 11:43:40
|
Hi Dan, I actually use objc.inject for a few projects, and it's a great debugging tool. I believe that your problem looks more like a bug in the InjectInterpreter code rather than in the lower-level objc.inject code (which works great!). In particular, try changing line 365 of InjectInterpreterPlugin.py from NSAnyEventMask to NSUIntegerMax. Logically, the use of NSAnyEventMask is correct in the above code. On the PyObjC side, however, it's a signed integer (at least in the PyObjC that comes with Leopard) instead of an unsigned integer. That's why NSUIntegerMax is functionally correct (even if logically incorrect) here. As for why NSAnyEventMask is signed instead of unsigned, that might be a bug in PyObjC. Maybe. >>> NSUIntegerMax 4294967295L >>> NSAnyEventMask -1 >>> struct.unpack('L', struct.pack('l', NSAnyEventMask))[0] # cast to unsigned 4294967295L Cheers! James Le 29 juil. 09 à 18:18, Daniel Ashbrook a écrit : > Re: "does anyone use objc.inject" from a few months ago, I think I > would like to. I'm hoping to get at the internals of a program and > extract some hard-to-get-at information. However, trying the > InjectInterpreter example code doesn't seem to work, so any hints > would be appreciated. Doing: > > sudo python test.py 71755 > > (where 7155 is the pid of TextEdit) returns without comment, but > prints to the system log: > > TextEdit[71755]: InjectInterpreterPlugin has encountered a fatal > error, and will now terminate. > TextEdit[71755]: An uncaught exception was raised during execution of > the main script:^M^MSystemError: NULL result without error in > PyObject_Call^M^MThis may mean that an unexpected error has occurred, > or that you do not have all of the dependencies for this bundle. > [0x0-0x48d48d].com.apple.TextEdit[71755]: Traceback (most recent call > last): > [0x0-0x48d48d].com.apple.TextEdit[71755]: File "/tmp/ > InjectInterpreter/dist/InjectInterpreterPlugin.plugin/Contents/ > Resources/__boot__.py", line 23, in <module> > [0x0-0x48d48d].com.apple.TextEdit[71755]: > _run('InjectInterpreterPlugin.py') > [0x0-0x48d48d].com.apple.TextEdit[71755]: File "/tmp/ > InjectInterpreter/dist/InjectInterpreterPlugin.plugin/Contents/ > Resources/__boot__.py", line 20, in _run > [0x0-0x48d48d].com.apple.TextEdit[71755]: execfile(path, > globals(), globals()) > [0x0-0x48d48d].com.apple.TextEdit[71755]: File "/tmp/ > InjectInterpreter/dist/InjectInterpreterPlugin.plugin/Contents/ > Resources/InjectInterpreterPlugin.py", line 187, in <module> > [0x0-0x48d48d].com.apple.TextEdit[71755]: class > PyInterpreter(NSTextView): > [0x0-0x48d48d].com.apple.TextEdit[71755]: SystemError: NULL result > without error in PyObject_Call > > Any hints? > > Thanks, > > > dan > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |