Open 19557102-6c81-49d0-9f56-a4c8aa600c00 opened 2 years ago
When i try to execute --link.exe *.obj-- on windows 11, i get one error LIB : fatal error LNK1181: cannot open input file 'Files.obj' It looks like a space path error so i run [os.spawnv(link.exe)] alone try to find out where made this error. But i cant DEBUG os.spawnv() on Pycharm. When the cursor on os.spawnv() line then press [Step Into], cursor jump to ntpath.py (216) it's in "def basename()" not in os.py "def spawnv()"
so this issue contain 2 parts 1.space error such as "Program Files (x86)" 2.DEBUG cant jump to right place
Here is my salmpe code.I have tried python3.8 and python3.10 both same error
import os
executable= 'D:\\VS2022\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\link.exe'
cmd310 = ["/LIBPATH:D:\\python310\\lib\\site-packages\\torch\\lib", "/LIBPATH:D:\\python310\\libs", "/LIBPATH:D:\\python310\\PCbuild\\amd64", "/LIBPATH:D:\\VS2019\\VC\\Tools\\MSVC\\14.29.30133\\ATLMFC\\lib\\x64", "/LIBPATH:D:\\VS2019\\VC\\Tools\\MSVC\\14.29.30133\\lib\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\um\\x64", "/LIBPATH:D:\\VS2019\\VC\\Tools\\MSVC\\14.29.30133\\lib\\x64", "/LIBPATH:D:\\VS2019\\VC\\Tools\\MSVC\\14.29.30133\\atlmfc\\lib\\x64", "/LIBPATH:D:\\VS2019\\VC\\Auxiliary\\VS\\lib\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.19041.0\\ucrt\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.19041.0\\ucrt_enclave\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.19041.0\\um\\x64", "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64", "/LIBPATH:D:\\python310\\libs", "c10.lib", "torch.lib", "torch_cpu.lib", "torch_python.lib"]
rc = os.spawnv(os.P_WAIT, executable, cmd310)
cmd310 = ["/LIBPATH:D:\\python310\\lib\\site-packages\\torch\\lib",
The argv
parameter of os.spawnv() should begin with a command name to ensure that the application parses its command-line correctly. This doesn't necessarily have to be a file path since the path
argument is what gets executed. For example, in this case I would use cmd310 = ["link", ...]
.
That said, for various reasons, including the correct quoting of command-line arguments that contain spaces, I recommend that you use the subprocess module instead of os.spawnv(). For example, use p = subprocess.run(cmd310, executable=executable)
. The first item of the argument list still needs to be "link" in this case. Or include the full path of "link.exe" at the start of cmd310, and use p = subprocess.run(cmd310)
.
But i cant DEBUG os.spawnv() on Pycharm.
In Windows, os.spawnv() is a builtin function from the nt extension module, defined in Modules/posixmodule.c. It is not defined in os.py. The C implementation is a minimal wrapper around the C runtime's _wspawnv() function [1]. Probably PyCharm isn't capable of debugging a builtin function.
--- [1] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnv-wspawnv
I can't use subprocess. Because the original problem is not that I want to use os.spawnv(). The original problem is that I go to install python3d, use setup.py install, the returned information shows that the compilation is completed, the link is also completed, and the installation is also completed. Done, but the pytorch3d folder is in the D:\Python38\Lib\site-packages\pytorch3d-0.6.1-py3.8-win-amd64.egg folder, which seems to be wrong because I moved it manually It can be used normally outside pytorch3d-0.6.1-py3.8-win-amd64.egg. (I wrote the detailed issue here [https://github.com/facebookresearch/pytorch3d/issues/1052]) So I I tried to use pycharm to debug the process. I wanted to see where the installation error was, so I encountered the problem of os.spawnv(). If you want to find the installation problem, you must first compile and link. This LIB: fatal error LNK1181: just Occurs in the link stage spawn.py (69). The strange thing is that the operation will not report an error, but DEBUG will report an error. So my salmpe code is all separated from D:\Python38\Lib\distutils\spawn.py (69), when the breakpoint stops here, rc = os.spawnv(os.P_WAIT, executable, cmd) The corresponding parameters are written in samlpe, here is another sample of mine, which can also be installed on my PC, but cannot use DEBUG for Pycharm
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['3.10', 'OS-windows']
title = 'cant DEBUG os.spawnv()'
updated_at =
user = 'https://github.com/michaellongge'
```
bugs.python.org fields:
```python
activity =
actor = 'michaellongge'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Windows']
creation =
creator = 'michaellongge'
dependencies = []
files = ['50598']
hgrepos = []
issue_num = 46578
keywords = []
message_count = 3.0
messages = ['412129', '412168', '412194']
nosy_count = 6.0
nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower', 'michaellongge']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue46578'
versions = ['Python 3.10']
```