Bug with Python, Cygwin and /dev/urandom?

Jeremy Cowles jeremy.cowles at gmail.com
Sat Aug 1 01:57:23 CEST 2009


urllib2.py is crashes when calling randombytes(n). I run the following under
Cygwin (mimicking how randombytes works):

$ python
Python 2.5.2 (r252:60911, Dec  2 2008, 09:26:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys,os
>>> os.path.exists("/dev/urandom")
True
>>> f = open("/dev/urandom")
>>> s = f.read(2)
>>> f.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 0] Error


Errno 0 is supposed to be impossible according to the following thread.
Apparently this same issue also causes Mercurial to crash:
http://www.nabble.com/hg-1.0-exits-with-abort:-Error-td19021833.html


Is this a bug?


--
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090731/5b636dfe/attachment.html>


More information about the Python-list mailing list