New submission from Hassan El Karouni: 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. ---------- components: Library (Lib) messages: 249228 nosy: Hassan El Karouni priority: normal severity: normal status: open title: traceback when using tempfile module on windows type: crash versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24944> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com