Bug with Python, Cygwin and /dev/urandom?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jul 31 22:06:39 EDT 2009


En Fri, 31 Jul 2009 20:57:23 -0300, Jeremy Cowles  
<jeremy.cowles at gmail.com> escribió:

> 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?

It seems so, but not necesarily a Python one; it might be a bug in cygwin  
instead.
If not already reported, file a bug at http://bugs.python.org/

-- 
Gabriel Genellina




More information about the Python-list mailing list