PyMOTW: getpass

Many programs which interact with the user via the terminal need to ask the user for password values without showing what the user types on the screen. The getpass module provides a portable way to handle such password prompts securely. Read more at getpass

Unexpectedly popular: svnbackup

My svnbackup script is the second most popular page on my site, after the PyMOTW home page, and search terms such as “svn backup” and “svn backup script” regularly appear at the top of the list of sources of traffic to my site. The link to svnbackup doesn’t appear on the first page of Google’s search results, a sign I take to mean that this problem isn’t well understood or solved (otherwise, why would so many people page through the search results to find it?

PyMOTW: atexit

The atexit module provides a simple interface to register functions to be called when a program closes down normally. The sys module also provides a hook, sys.exitfunc, but only one function can be registered there. The atexit registry can be used by multiple modules and libraries simultaneously. Read more at atexit

PyMOTW: subprocess

The subprocess module provides a consistent interface to creating and working with additional processes. It offers a higher-level interface than some of the other available modules, and is intended to replace functions such as os.system, os.spawn*, os.popen*, popen2.* and commands.*. To make it easier to compare subprocess with those other modules, this week I will re-create earlier examples using the functions being replaced. Read more at subprocess

PyMOTW: pickle and cPickle

The pickle module implements an algorithm for turning an arbitrary Python object into a series of bytes (“serializing” the object). The byte stream can then be transmitted or stored, and later reconstructed to create a new object with the same characteristics. The cPickle module implements the same algorithm, in C instead of Python. It is many times faster than the Python implementation, but does not allow the user to subclass from Pickle.

DjangoKit help?

I spent a little time last night trying to assemble an application using DjangoKit without much success. I’m running Python 2.5 on a PowerBook with Mac OS 10.4. I downloaded and installed PyObjC from source so it would compile (I thought) against the right version of Python, then installed DjangoKit using python install. Everything seemed to be working, and I was able to build an application. But when I ran that app, it produced an error about the version of the SQLite libraries being used (2 instead of 3) and missing libraries.

PyMOTW: os (Part 4)

This week I am wrapping up coverage of the os module (saving os.path for a future post of its own) and discuss functions useful for working with multiple processes. I covered use of pipes in part 2, so this week we will look at system(), fork(), exec(), and related functions. Read more at os/index.html#running-external-commands

PyAtl Presentations

Last night’s Atlanta Python Meetup included several interesting presentations. Living so far outside of Atlanta, it isn’t easy to make it down for as many of the meetings as I would like, but it was definitely worth the effort last night. We had a larger than usual crowd, due to the fact that Google was sponsoring pizza and providing speakers, all apparently part of their current recruiting drive. Cary Hull of Google talked about twisted.

PyMOTW: os (Part 3)

The previous installments covered process parameters and input/output. This week I will look at some of the functions for working with files and directories. Read more at os/index.html#file-descriptors

Dialing down email distractions

I have been experimenting with various productivity hacks lately. I feel like I’m already fairly productive, based on tracking the amount of work I accomplish week-to-week. So instead of trying to do more, I’m trying to maintain the same level of output with less effort (and hopefully time). One of the top tips I have seen repeatedly is to reduce the amount of time spent checking email, and only check it a couple of times per day.