[Twisted-Python] Re: [Pyobjc-dev] Re: pdb in PyObjC apps?

On Tuesday, Aug 19, 2003, at 05:45 America/New_York, Michael Hudson wrote:
Zachery Bir <zbir@urbanape.com> writes:
Note to self: Don't use pdb and try to catch it through double-clicking the app :)
:-)
It shouldn't be *too* outrageously hard to teach my pyrepl interactive tool how to cooperate with the Cocoa run loop (you need a way to give an fd to Cocoa and say "give me control when there's something to read on this" and I'm sure I saw one of them somewhere) in which case you could have an interactive session running alongside your application... Hmm, where's that can of tuits?
I've developed a CoreFoundation reactor for Twisted that would facilitate this sort of thing. It's not mainline yet because I haven't had time to fully test and write enough examples -- it does work, but I'm not currently comfortable putting it in the rest of Twisted yet (especially due to the Pyrex build dependency). Here's what you would do (this obviously needs Developer Tools installed): Download Pyrex 0.8.2 Modify Pyrex/Compiler/Nodes.py .. change the block starting on line 160 to this (small fix to allow system includes): for filename in env.include_files: if not (filename.startswith('<') and filename.endswith('>')): filename = '"%s"' % filename code.putln('#include %s' % filename) Install Pyrex Checkout CVS HEAD of Twisted Build and install Twisted (or put twisted into your PYTHONPATH, I have a symlink of ~/src/Twisted/twisted at ~/Library/Python/2.3/site-packages/twisted) Go into Twisted/sandbox/etrepum/cfsupport python setup.py build_ext -i cd TWISTEDPACKAGE/internet ln -s TWISTEDCVS/sandbox/etrepum/cfreactor.py . ln -s TWISTEDCVS/sandbox/etrepum/cfsupport/cfsupport.so . That should work, to test it check out the examples in TWISTEDCVS/sandbox/etrepum/examples/PyObjC (which obviously require PyObjC, you can get that from PackageManager) Also note that the cfsupport module is enough to just get notifications on the fd, but I recommend using Twisted for anything that talks sockets anyway. -bob

On Tuesday, 19 August, 2003, at 16:06, Bob Ippolito wrote:
On Tuesday, Aug 19, 2003, at 05:45 America/New_York, Michael Hudson wrote:
Zachery Bir <zbir@urbanape.com> writes:
Note to self: Don't use pdb and try to catch it through double-clicking the app :)
:-)
It shouldn't be *too* outrageously hard to teach my pyrepl interactive tool how to cooperate with the Cocoa run loop (you need a way to give an fd to Cocoa and say "give me control when there's something to read on this" and I'm sure I saw one of them somewhere) in which case you could have an interactive session running alongside your application... Hmm, where's that can of tuits?
I've developed a CoreFoundation reactor for Twisted that would facilitate this sort of thing. It's not mainline yet because I haven't had time to fully test and write enough examples -- it does work, but I'm not currently comfortable putting it in the rest of Twisted yet (especially due to the Pyrex build dependency).
Here's what you would do (this obviously needs Developer Tools installed):
Download Pyrex 0.8.2
Modify Pyrex/Compiler/Nodes.py .. change the block starting on line 160 to this (small fix to allow system includes): for filename in env.include_files: if not (filename.startswith('<') and filename.endswith('>')): filename = '"%s"' % filename code.putln('#include %s' % filename)
Install Pyrex
Checkout CVS HEAD of Twisted
Build and install Twisted (or put twisted into your PYTHONPATH, I have a symlink of ~/src/Twisted/twisted at ~/Library/Python/2.3/site-packages/twisted)
Go into Twisted/sandbox/etrepum/cfsupport
python setup.py build_ext -i
cd TWISTEDPACKAGE/internet ln -s TWISTEDCVS/sandbox/etrepum/cfreactor.py . ln -s TWISTEDCVS/sandbox/etrepum/cfsupport/cfsupport.so .
That should work, to test it check out the examples in TWISTEDCVS/sandbox/etrepum/examples/PyObjC (which obviously require PyObjC, you can get that from PackageManager)
Also note that the cfsupport module is enough to just get notifications on the fd, but I recommend using Twisted for anything that talks sockets anyway.
Why didn't you use PyObjC? Is there functionality in CoreFoundation that is not in Cocoa or are there other reasons? Ronald

On Wednesday, Aug 20, 2003, at 02:25 America/New_York, Ronald Oussoren wrote:
Why didn't you use PyObjC? Is there functionality in CoreFoundation that is not in Cocoa or are there other reasons?
CFSocket notifications, (theoretical) Carbon runloop support, etc. I wrote it in Pyrex after a huge waste of time trying to get it to work reliably in ctypes (callbacks would eventually start jumping to random locations in memory under load, core dump on uncaught exceptions, etc... I think it could be a libffi issue), and I didn't want to go through the same ordeal with PyObjC's callbacks after my last failed attempt to do Rendezvous callbacks with it. The Pyrex module was not hard to write, and my wrapper does take a CFRunLoopRef from a PyObjC NSRunLoop if you're trying to integrate it with Cocoa or whatever. -bob

Noticing a few broken links on the twistedmatrix.com website. Didn't find any mention of where to email such bug to. Probably not to this list. Anyone know?

On Thursday, Aug 21, 2003, at 20:12 America/New_York, Richard Johannesson wrote:
Noticing a few broken links on the twistedmatrix.com website. Didn't find any mention of where to email such bug to. Probably not to this list. Anyone know?
http://www.twistedmatrix.com/bugs/ Create yourself an account And post issues with the Topics field filled out as "website", sans quotes. -bob
participants (3)
-
Bob Ippolito
-
Richard Johannesson
-
Ronald Oussoren