Python Exception Handling Techniques

Error reporting and processing through exceptions is one of Python’s key features. Care must be taken when handling exceptions to ensure proper application cleanup while maintaining useful error reporting. Error reporting and processing through exceptions is one of Python’s key features. Unlike C, where the common way to report errors is through function return values that then have to be checked on every invocation, in Python a programmer can raise an exception at any point in a program.

installing GNU gettext for use with Python on OS X

I’ve been working on my blog post about Python’s gettext module for the past couple of mornings, and ran into a snag. The documentation claims that the Python source distribution includes all the tools you’ll need, but when I got to the point where I wanted to write examples of internationalizing plural strings, pygettext.py wasn’t working. It worked great for extracting individual string messages up to that point, but refused to extract messages wrapped in the ungettext() call, even when I used what seemed to be the appropriate command line options.

PyMOTW: gettext

The gettext module provides an all-Python implementation compatible with the GNU gettext library for message translation and catalog management. The tools available with the Python source distribution enable you to extract messages from your source, build a message catalog containing translations, and use that message catalog to print an appropriate message for the user at runtime. Message catalogs can be used to provide internationalized interfaces for your program, showing messages in a language appropriate to the user.

Book Review: The Economics of Iterative Development

The Economics of Iterative Software Development, by Walker Royce, Kurt Bittner, and Mike Perrow, covers techniques for achieving more predictable results with development projects. Disclaimer: I received a review copy of this book through the PyATL Book Club. The goal of the book is to encourage adoption of iterative development processes, rather than the old-fashioned waterfall model (does anyone really still use that model?). In the authors’ view, iterative processes, where one builds a rough version of a product and continually refine it over time, yield better results in terms of predictable schedule and meeting real requirements.

Using Readernaut for taking notes on books

Over the past couple of months I’ve been working on reviving the PyATL book club. We received our first batch of books from Addison-Wesley/Pearson Education in time to distribute them at our meeting last month. I’ll be posting my review soon, but before I do that I wanted to share my experiences with Nathan Borror’s excellent http://readernaut.com/. The site is easy to use. Once you have an account, just use the search field to find a book, either already in the Readernaut catalog or at Amazon.

new project: sphinxcontrib-paverutils

Kevin Dangoor’s Paver includes basic integration for Sphinx, the excellent document production toolkit from Georg Brandl. As I have written before, however, the default integration didn’t quite meet my needs for producing different forms of output from the same inputs. Georg has opened the sphinxcontrib repository on BitBucket for developers who want to collaborate on providing unofficial extensions to Sphinx, so I decided to go ahead and package up the alternate integration I use and release it in case someone else finds it helpful.

python-authors mailing list

At PyCon this year, a group of authors and editors met to start building the writing sub-community for people interested in Python-related topics appearing online and in print. One of the suggestions that came out of the meeting was to establish a new SIG mailing list, hosted on python.org. I’m pleased to announce that the python-authors list has been established and is ready to host traffic! If you have any experience or interest in writing, editing, or reviewing technical writing such as blog posts, magazine articles, or books, this list is for you.

Data persistence tools in the Python Standard Library

This is the first in a new sub-series of Python Module of the Week posts with a feature-based introduction to modules in the standard library, organized by what your goal might be. Each article may include cross-references to several modules from different parts of the library, and show how they relate to one another. Feedback is welcome, as usual. Data Persistence and Exchange Python provides several modules for storing data. There are basically two aspects to persistence: converting the in-memory object back and forth into a format for saving it, and working with the storage of the converted data.

Japanese translation of PyMOTW

I am very pleased to announce that Tetsuya Morimoto is creating a Japanese translation of the Python Module of the Week series. Tetsuya has used Python for 1.5 years. He has experience at a Linux Distributor using Python with yum, anaconda, and rpm-tools while building RPM packages. Now, he uses it to make useful tools for himself, and is interested in application frameworks such as Django, mercurial and wxPython. Tetsuya is a member of Python Japan User’s Group and Python Code Reading.

PyMOTW: json

The json module provides an API similar to pickle for converting in-memory Python objects to a serialized representation known as “JavaScript Object Notation”. Unlike pickle, JSON has the benefit of having implementations in many languages (especially JavaScript), making it suitable for inter-application communication. JSON is probably most widely used for communicating between the web server and client in an AJAX application, but is not limited to that problem domain. Read more at pymotw.