The subprocess
module in Python 2.4 has a race
condition. If you're doing process.communicate() on more than one pipe, on
a Unix-like system you may end up getting an exception (4, 'Interrupted
system call') when the child process terminates, if the SIGCHLD signal arrives
at an inopportune moment.
This bug appears to be fixed in Python 2.5.2, where all calls to select,
read and write are wrapped in a while looks and ignore EINTR errors.
Maybe this blog post will save someone else the hour needed to
study strace logs trying to figure this out.
Update: It's not fixed in upstream Python.
Ubuntu patched
it a year ago for python2.5, but not for python2.4. Upstream knows about the patch, but so far
only a partial fix
(EINTR guard around select, but not around read/write) has made it into svn
trunk (but not the 2.5 maintenance branch, yet, and I'm not even thinking
about 2.4).
Today was a release day for me.
I released eazysvn
1.8.0, the helpful syntactic sugar wrapper that makes using Subversion branches
almost not painful. This is the first release with full on-line documentation
(at last).
I also bumped the version number of restview, my ReStructuredText viewer, to a
solid 1.0.0. I've been using it for years now without problems, which was not
immediately apparent from the old version number (a modest 0.0.5).
Before that I made my first ever bugfix releases of a couple of Zope 3
packages (zope.component 3.5.1 and
zope.app.testing
3.4.3). Blame me if anything is wrong with them. Kudos to Philipp von
Weitershausen for his release
process documentation.
So, you hear
that your media player supports
remote control over D-Bus. That's great,
isn't it?
So, you're lying on a couch, listening to music and reading a book on your
N810. Suddenly a song
you don't like starts playing. Do you
A. Stand up, walk to the PC, click the "Next song" button with your
mouse,
or
B. Open Terminal on your N810, ssh into your desktop and run
banshee-1 --next?
If you chose option B, you lose:
mg@mg-desktop:~$ banshee-1 --next
[Warn 00:43:59.080] DBus support could not be started. Disabling for this session.
[Info 00:43:59.101] Running Banshee 1.0.0
(Nereid:9174): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
(Nereid:9174): Gtk-WARNING **: cannot open display:
You can't access your D-Bus session from a different login session.
This means, among other things, that I cannot ask gnome-power-manager to
suspend my laptop that I left at work if I'm trying to run
gnome-power-cmd.sh suspend over an SSH session.
Dear lazyweb, what's the fix?
P.S. I apologise for the impertinence of asking dear lazyweb a
question on a blog that has no comments facility, but I somehow cannot bring myself to trust
Pyblosxom's comment
plugins in today's spam-filled world without an in-depth evaluation for
which I don't have the time and energy. At least there's a mailto link clearly
labeled "send feedback" below each blog
entry.
Update: Steve Holden suggested using screen, which works, but only if
I have the foresight to start a screen session on the desktop before I walk
away. I can then reattach to the running screen session with screen
-x and run banshee-1 --next inside.
Ross Burton says that setting DISPLAY=:0 ought to help D-Bus
find the existing session, but only if I have the very latest and greatest
D-Bus (1.2.1), which I don't have. With D-Bus 1.1.20 in Hardy, all I get by
setting $DISPLAY is Banshee opening a second player instance.
Update #2: Lee Harr suggests fishing out the
DBUS_SESSION_BUS_ADDRESS environment variable from ~/.dbus/session-bus/*.
Update #3: Kees Cook also has a
solution.
Hacked on XDot,
which uses PyGtk/Cairo and the xdot intermediate format and thus sidesteps the
limitations I encoutered working on
dotviewer. My changes are in a Git branch created with git-svn. Get it
here:
git clone http://mg.pov.lt/xdot-mg.git
Try it out
cd xdot-mg
./xdot.py sample2.dot
See the changes
gitk --all
Overview:
- Supports more .dot features.
- Nicer node rendering.
- Animated jumping between nodes.
- Highlights node/edge under mouse.
- Ctrl-drag zooms.
- Shift-drag zooms an area.
- File open dialog.
- Zoom-to-fit reacts to window resize.
I must admit that git is nicer than bzr to work with, but a bit of a pain
when you want to publish or share your changes.
I will not be sprinting tomorrow.
Hacked on dotviewer
that was developed for PyPy but is now a standalone tool. My
changes are in a Bazaar branch created with bzr-svn. Get it here:
bzr get http://mg.pov.lt/dotviewer-mg/
Try it out
cd dotviewer-mg
./dotviewer.py sample2.dot
See the changes
bzr vis
Overview:
- Supports more .dot features.
- Nicer node highlighting.
- Easier panning for one-mouse-button users (Shift+drag).
- Better edge navigation close to the borders of the graph.
- Renders small fonts too.
Then I hit some limitations: it's either impossible or very hard to get
pretty anti-aliased output or smooth text scaling with Pygame. It's impossible to
support all dot features using the plain
intermediate format.
Highlights from EuroPython 2008:
- Nice badges! Large, readable font, nice design, pretty logo, no
clutter.
- Wifi worked great most of the time.
- Reportlab paragraph hyphenation is in a sorry state (nothing in the core,
several extensions that sort of support it but are incomplete or hard to
integrate); I should take a closer look at Dinu Gherman's work.
- I should take a closer look at Vudo.
- Phatch is cool.
- Capistrano is interesting (and the
slides were very pretty); shame I missed most of the talk. It was recorded, so
hopefully I'll get a chance to see it.
- Eggs and zc.buildout
are getting traction despite their rough edges.
- The Asus EeePC is convenient at conferences, if there are enough power
sockets around, or if you're careful and suspend it often.
Won a Wing IDE licence in the raffle. Not going to use it myself (vim is the
best, and I should publish my plugins). Also, I avoid closed-source software
when I can.