New submission from Nikita Sobolev <[email protected]>:
When trying to import both `windows_events` and `windows_utils` on non-Windows,
they both fail.
But, they fail differently. `windows_utils` produces a good error message, whil
`windows_events` produces a strange one.
Good:
```
Python 3.11.0a3+ (heads/main:8d7644fa64, Dec 30 2021, 13:00:40) [Clang 11.0.0
(clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio.windows_utils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sobolev/Desktop/cpython/Lib/asyncio/windows_utils.py", line 6,
in <module>
raise ImportError('win32 only')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: win32 only
```
Not so good:
```
>>> import asyncio.windows_events
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sobolev/Desktop/cpython/Lib/asyncio/windows_events.py", line 3,
in <module>
import _overlapped
^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_overlapped'
```
I propose to use the same error message `windows_utils` does.
----------
components: asyncio
messages: 409571
nosy: asvetlov, sobolevn, yselivanov
priority: normal
severity: normal
status: open
title: Incosistent error message in asyncio: windows_events / windows_utils
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46239>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com