Hi Folks,
I'm doing some development for a plugin (it is the X-Ray plugin that Matthew Wilson originally wrote), and I'm hitting a rather puzzling problem.
Copious notes below, but basically writing to see if:
- anyone is seeing similar issues with this or other plugins
- anyone has any ideas where to look for the problem
The symptom of the problem is simply the IOError(32, "Broken pipe") exception being raised when the plugin tries to write to stdout (directly or via print).
I have found various mentions of this exception relating to Calibre, but a lot of those seem to be caused by virus software causing problems getting webpages. I found one mention of a different case, but no solution or further information to go on.
Cheers,
Anthony
Sometimes I cannot reproduce the problem if I try (mostly when I've set aside some time to look at it!), the rest of the time I hit it very readily. The problem is never hit on the first run of the plugin, but is very often hit on the second and subsequent runs. It takes a restart of Calibre to get things working again.
The error is seen when a call to print or sys.stdout.write is made in that plugin - and depending on which of those is called I either get the IOError(32, "Broken pipe") mentioned in the subject or sometimes get an odd IOError(0) exception.
I've had a quick dig around the code to see where pipes are used - I'm assuming the problem is that whatever our plugin's stdout is connected to is has closed the pipe, hence the exception. However, "pipe" seems to be found a lot in the code - so really it seems more sensible to try to understand how the code works/where likely pipes are, rather than finding the bug via code inspection