Eryk Sun added the comment:
I had reopened this issue with a suggestion for expanding the supported paths
in msg276864, but it's languished for a while now. I've attached a patch
implementing the change to _PyIO_get_console_type that I had suggested. Here
are some example paths that this change enables (tested in Windows 10; need to
check Windows 7):
\\.\conin$
\\.\conout$
\\.\con
//?/con
C:/Temp/con
C:/Temp/conout$
C:/Temp/conin$
Paths such as "C:/Temp/con" are recognized by first converting to a device path
such as r"\\.\con". It's fine if the directory doesn't exist because CreateFile
will fail anyway in that case.
This patch also fixes an error in handling the return value of _get_osfhandle
when it fails.
It also adds a couple checks to __init__ to provide a better error message when
io._WindowsConsoleIO is called directly for some reason instead of via open().
If the console type can't be determined it should error out immediately instead
of printing an unrelated error about not being able to open the input/output
buffer.
----------
keywords: +patch
Added file: http://bugs.python.org/file46461/issue_28164_01.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28164>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com