ADN-DevTech / 3dsMax-Python-HowTos

3ds Max python samples
MIT License
230 stars 52 forks source link

mxvscode-autodesk seems not work #38

Open lifeyf opened 1 year ago

lifeyf commented 1 year ago

after cd in max install dir[3dsmax 2022], and "D:/project/3dsMax-Python-HowTos/install.sh",every thing seems right until I start 3dsmax :

mxvscode startup enabling vscode debugging
(if you don't use VSCode for debugging Python you can uninstall
mxvscode)
skipped package startup for mxvscode-autodesk 0.0.1, startup not working

Expecially, the pip cant update, very confused because I have used a newer version of python, where can i start pip ,python. ## can you please just set it into 3dsmax--- the cmd and the console.

i am a artist, not a programmer ,umm , this is really not easy to me.

then I just open the script run it in 3dsmax:

import sys
import os
import debugpy

sysexec = sys.executable
(base, file) = os.path.split(sys.executable)

if file.lower() == "3dsmax.exe":
    sys.executable = os.path.join(base, "python", "python.exe")
host = "localhost"
port = 5678
debugpy.listen((host, port))
print(f"-- now ready to receive debugging connections from vscode on (${host}, ${port})")
sys.executable = sysexec
### output:
Traceback (most recent call last):
  File "<input>", line 12
  File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\debugpy\public_api.py", line 31, in 'wrapper' function
  File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\debugpy\server\api.py", line 143, in 'debug' function
  File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\debugpy\server\api.py", line 141, in 'debug' function
  File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\debugpy\server\api.py", line 234, in 'listen' function
RuntimeError: error spawning debug adapter: [WinError 2] The system cannot find the file specified
hugow commented 1 year ago

I will try it in 2022.

hugow commented 1 year ago

I just tried in 2022 and it worked for me. Is it possible that you don't have VStudio on your machine (just guessing after reading this https://stackoverflow.com/questions/71342354/failed-to-launch-debug-adapter-in-visual-studio-2022)? If it's the case and you don't want to remote debug python in 3dsMax (using VStudio) just ignore.

Other, just in case. On my fresh 2022 install, when I do:

cd /c/Program Files/Autodesk/3ds Max 2022/python37

and then

./python -m pip show debugpy

I see:

Name: debugpy
Version: 1.7.0
Summary: An implementation of the Debug Adapter Protocol for Python
Home-page: https://aka.ms/debugpy
Author: Microsoft Corporation
Author-email: ptvshelp@microsoft.com
License: MIT
Location: c:\users\windishadmin\appdata\roaming\python\python37\site-packages
Requires:
Required-by: mxvscode-autodesk

So my version of this is 1.7.0

maybe if it's not the case on your side you could try reinstalling debugpy

./python -m pip install --user --upgrade --force-reinstall debugpy