Bill Bumgarner

2004-3-21

Of Subversion, Python, Warnings, PyObjC & Toes....

I was going to spend the afternoon gardening, but I managed to rip a toenail off on a rock. On the follow through, I managed to scrape the then exposed cuticle on the rock. That pretty much eliminated gardening for the afternoon. Or walking, for that matter. I'd post a picture, but it is not my intention to compete with Rotten.com (no, really, don't click that).

However, it did give me an opportunity to putter around the computer for a bit...

I now have a personal Subversion repository set up at http://svn.red-bean.com/bbum/. It doesn't contain anything yet, but that is to change shortly. The intention is to finally coalesce and import nearly 15 years of Objective-C and Python hacquery into one place that I can easily get too. If, in the process, others find it useful, so much the better.

The first project to make the jump is DeDat. It is a three or four year old PyObjC application that wraps around TNEF to rip apart attachments produced by certain mail programs (every receive an attachment labeled "foo.dat"?).

In cleaning it up, I ran across a deprecated warning. I was using API in PyObjC that had been moved somewhere else. Ronald has done a brilliant job of maintaining backwards compatibility across refactors, but Hubris encourages me to eliminate use-of-deprecated-API functionality any time I encounter it in a context I have control over.

Python has a warnings module that Ronald is using to indicate deprecated functionality. By default, it will happily tell you that you are using deprecated API, but not exactly where in your code.

Easy to fix. Once the 'warnings' module is imported, just set the defaultaction to error:

 warnings.defaultaction = "error" 

Your app will now crash violently upon use of deprecated API, dumping a full backtrace in the process.

Comment on this post [ so far] ... more like this: [PyObjC, Python, Subversion] ... topic exchange: [PyObjC, Python, Subversion]