Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message on non Win #3

Merged
merged 3 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions WConio2.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,24 @@

# connect to kernel32.dll, which actually does all the business.

import sys
import ctypes
from ctypes import windll
from ctypes.wintypes import *
try:
from ctypes import windll
from ctypes.wintypes import *
import msvcrt
except ImportError as e:
msg = "\n".join((
"Some items not available (maybe it's the wrong platform).",
"Note that conio.h is only supported on Windows.",
"For more details, please check: "
"https://learn.microsoft.com/en-us/cpp/c-runtime-library/console-and-port-i-o"))
print(msg)
raise e
#raise ImportError(msg) from e # @TODO: drop Py2 and use this line
# missing from 2.7 wintypes
CHAR = ctypes.c_char
LPDWORD = ctypes.POINTER(DWORD)
import msvcrt
import sys

# Python 2 and 3 handle wchar type initializers differently
# this is meant to deal with that
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],
Expand Down