<div class="gmail_quote">On 25 September 2012 08:27, Mark Lawrence <span dir="ltr"><<a href="mailto:breamoreboy@yahoo.co.uk" target="_blank">breamoreboy@yahoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 25/09/2012 03:32, Mark Adam wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin<br>
<<a href="mailto:oscar.j.benjamin@gmail.com" target="_blank">oscar.j.benjamin@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">try:<br>
     f.pos = 256<br>
except IOError:<br>
     print('Unseekable file')</blockquote>
</blockquote>
<br></div></div>
Something along these lines <a href="http://docs.python.org/dev/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy" target="_blank">http://docs.python.org/dev/<u></u>whatsnew/3.3.html#pep-3151-<u></u>reworking-the-os-and-io-<u></u>exception-hierarchy</a> ?</blockquote>
<div><br></div><div>I just tried to find out what error would be raised by seeking on a file that doesn't support seeking and II think it's just OSError in the reworked hierarchy. The error in Python 2.7 is</div><div>
<br></div><div><div>Traceback (most recent call last):</div><div>  File "tmp.py", line 2, in <module></div><div>    sys.stdin.seek(5)</div><div>IOError: [Errno 29] Illegal seek</div></div><div><br></div><div>
This corresponds to ESPIPE from errno.h which isn't referred to anywhere in pip 3151:</div><div><a href="http://www.python.org/dev/peps/pep-3151/">http://www.python.org/dev/peps/pep-3151/</a></div><div><br></div><div>
So I guess it would still need to be</div><div><br></div><div>try:</div><div>    f.pos = 256</div><div>except OSError as e:</div><div>    if e.errno != 29:</div><div>        raise</div><div>    print('Unseekable file')</div>
<div><br></div><div>Oscar</div></div>