diff --git a/pytensor/configdefaults.py b/pytensor/configdefaults.py index 673d41039f..e383646949 100644 --- a/pytensor/configdefaults.py +++ b/pytensor/configdefaults.py @@ -348,7 +348,7 @@ def add_compile_configvars(): if sys.platform == "win32": mingw_w64_gcc = Path(sys.executable).parent / "Library/mingw-w64/bin/g++" try: - rc = call_subprocess_Popen([mingw_w64_gcc, "-v"]) + rc = call_subprocess_Popen([str(mingw_w64_gcc), "-v"]) if rc == 0: maybe_add_to_os_environ_pathlist("PATH", mingw_w64_gcc.parent) except OSError: diff --git a/pytensor/utils.py b/pytensor/utils.py index 1f33300629..3943cc612c 100644 --- a/pytensor/utils.py +++ b/pytensor/utils.py @@ -123,7 +123,7 @@ def maybe_add_to_os_environ_pathlist(var: str, newpath: Path | str) -> None: pass -def subprocess_Popen(command, **params): +def subprocess_Popen(command: str | list[str], **params): """ Utility function to work around windows behavior that open windows. @@ -131,11 +131,11 @@ def subprocess_Popen(command, **params): """ startupinfo = None if os.name == "nt": - startupinfo = subprocess.STARTUPINFO() + startupinfo = subprocess.STARTUPINFO() # type: ignore[attr-defined] try: - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # type: ignore[attr-defined] except AttributeError: - startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW + startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW # type: ignore[attr-defined] # Anaconda for Windows does not always provide .exe files # in the PATH, they also have .bat files that call the corresponding