Closed tcztzy closed 3 years ago
I try to patch check_with_path
like following, does it help?
https://github.com/tox-dev/tox/blob/156d4961dd50ee629c3c4c78c09ba6b1c0da76d3/src/tox/interpreters/via_path.py#L17
_python_path_cache = {}
PATH_QUERY_SCRIPT = "import _winapi;print(_winapi.GetModuleFileName(0), end='')"
def get_python_path(cmd):
try:
return _python_path_cache[cmd].copy()
except KeyError:
pass
proc = subprocess.Popen(
[cmd, "-c", PATH_QUERY_SCRIPT],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
)
out, err = proc.communicate()
if not proc.returncode:
try:
result = out
except ValueError as exception:
failure = exception
else:
_python_path_cache[cmd] = result
return result.copy()
else:
failure = "exit code {}".format(proc.returncode)
reporter.verbosity1("{!r} cmd {!r} out {!r} err {!r} ".format(failure, cmd, out, err))
def _patch(func):
@wraps(func)
def wrapper(*args, **kwds):
result = func(*args, **kwds)
if result is None or not result.lower().startswith(
os.path.join(
os.environ.get("LOCALAPPDATA", ""),
"Microsoft",
"WindowsApps",
"PythonSoftwareFoundation.Python"
).lower()
):
return result
return get_python_path(result)
return wrapper
check_with_path = _patch(_check_with_path)
Can you try with https://pypi.org/project/tox/4.0.0a8/, that should fix it I think.
Can you try with https://pypi.org/project/tox/4.0.0a8/, that should fix it I think.
Thanks, it works now.
I installed multiple version Python from Windows Store, their versions are:
When I use
tox -vve py37
I got the error message at last of this issue.As we can see in following codes,\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe" which cannot be read directly.
base_discover
andlocate_via_pep514
both failed, so the executable is resolved bypy.path
, and finally found the "C:\Users\https://github.com/tox-dev/tox/blob/156d4961dd50ee629c3c4c78c09ba6b1c0da76d3/src/tox/interpreters/windows/__init__.py#L12-L33
The problem is due to the limitation of Windows Store apps, Python's developer discussed about this, and then fix it in this.
Since
[py](https://github.com/pytest-dev/py)
is maintain only, I think this problem should be solved in tox side.Thanks for your efforts!
VERBOSE MESSAGE