-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
The project I use, runs both on Windows and Linux. The code is all platform specific, but mypy
keeps ignoring it:
File: anki/pylib/anki/utils.py
286: def call(argv: List[str], wait: bool = True, **kwargs) -> int:
287: "Execute a command. If WAIT, return exit code."
288: # ensure we don't open a separate window for forking process on windows
289: if isWin:
290: si = subprocess.STARTUPINFO()
291: try:
292: si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- If I add
# type: ignore
to lines290
and292
then,mypy
works on Linux, but it fails on Windows witherror: unused 'type: ignore' comment
- If I remove the
# type: ignore
from the lines290
and292
then,mypy
works on Windows, but it fails on Linux witherror: Module has no attribute "STARTUPINFO" [attr-defined]
.
The STARTUPINFO
is not defined for Linux Implementations, but is is for Windows implementation. That is why both of them are both protected by a if isWin
or if _mswindows
on this project and on the subprocess
module implementation:
File: F:/Python/lib/subprocess.py
164: if _mswindows:
165: class STARTUPINFO:
How can I make this # type: ignore
platform specific?
(pyenv) F:\anki>mypy --version
mypy 0.761
johnthagen and fohrloop
Metadata
Metadata
Assignees
Labels
No labels