Message249228
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.mkstemp()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\tempfile.py", line 308, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "C:\Python27\lib\tempfile.py", line 240, in _mkstemp_inner
_set_cloexec(fd)
File "C:\Python27\lib\tempfile.py", line 50, in _set_cloexec
flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
AttributeError: 'module' object has no attribute 'F_GETFD'
On line 51 in tempfile.py, an AttributeError exception is not caught. The problem is caused by the fact that on Windows, the fcntl module is supposed not to exist, but in my case, a dummy module with the same name was put on the path. This means that line 50 is run thru when making the mkstemp() call.
The fix is to catch the AttributeError exception on line 51.
The bug might also affect Python 3 but this is to be checked. |
|
Date |
User |
Action |
Args |
2015-08-27 09:15:35 | Hassan El Karouni | set | recipients:
+ Hassan El Karouni |
2015-08-27 09:15:35 | Hassan El Karouni | set | messageid: <1440666935.19.0.799788470417.issue24944@psf.upfronthosting.co.za> |
2015-08-27 09:15:35 | Hassan El Karouni | link | issue24944 messages |
2015-08-27 09:15:34 | Hassan El Karouni | create | |
|