Hi,
I'm trying to start edit/debug on a script from Fusion360, but when pressing debug or edit nothing happens. I've installed Visual Studio Code and I have Python 3.8.0. Also, when I open the script manually in VS Code I cannot run it because it doesn't find the required modules (e.g. adsk), but it runs fine when run from within Fusion360. Does anyone know how to fix this? 🙂 I suspect there is some path I have to configure somewhere?
Thanks in advance,
Snorre Hukkelås
Solved! Go to Solution.
Solved by Nilesh.Mohite. Go to Solution.
So I got a step further by following "Problem debugging Python code" and "Cannot debug Python add-in" found here: https://modthemachine.typepad.com/my_weblog/fusion-360/😊
Now Visual studio starts up and the code compiles, but I can't run it:
ModuleNotFoundError: No module named 'adsk'
AND now I got further by understanding that you need to run the program from within Fusion360, Tools ->Add-ins->Scripts and add-ins->"your script"->Run.
To start a debug session simply place some breakpoints and in VS Code, do Debug->Start Debugging.
Hi @Anonymous ,
It is issue with latest python extension installed in VSCode.
You need to downgrade the ms-python extension from VScode to lower version 2019.9.34911.
Please refer to the following similar issue.
API debugger doesn't work after Oct 2019 update
Solutions provided by @goyals will work for you. Go to Solution.
The window you are seeing is fusion checks for the extension if it not there it will try to install latest extension.
Please make sure to close fusion when you are doing this. Also restart VScode.
To verify, you can check your directory on windows %HOMEPATH%/.vscode/extensions/ on mac ~/.vscode/extensions/ this directory should contain only one ms-python extension version 2019.9.34911. If it contains another version please delete that folder also in .obsolete file if there is entry for ms-python extension you should remove it.
If my answer helped you, please use ACCEPT SOLUTION .
Also be generous with Likes! Thank you and enjoy!
Hi @Anonymous ,
Further, to debug or edit scripts, you can select the script from fusion Addins menu and click on "edit" or "debug"(debug option os present in dropdown menu button near Run button).
Once script is opened in VSCode you can hit F5 or greenb in configuration to attach script for debugging. If you are in edit mode you need to add breakpoint manually.
If you are missing any modules especially for mac.you can further refere to following post for verifying your settings of python def files(for OSX)
Lets us know if you need further help.
If my answer helped you, please use ACCEPT SOLUTION .
Also be generous with Likes! Thank you and enjoy!
Currently there is a bug in the never versions of ms-python for vscode. like mentioned above the best way to fix it is to downgrade the extension. If you're unsure how, here is where you go. Hope this helps 🙂
Thank you very much, @Nilesh.Mohite ! Maybe I did something wrong, but this workaround still seems to be needed in April, 2020.
The new build of ms-python.python-2020.5.80290 from 19 May 2020 also does not want to debug Fusion scripts...
the previous one (ms-python.python-2020.5.78807) works fine
I am still getting these errors. In my case, I receive no errors if I execute my Python script from Fusion 360. Once I start from Fusion 360, I am able to edit the same script in Visual Studio Code and everything works. I want to know if it is possible to run the script in VCS directly without first opening it in Fusion 360. If it can be done, the benefit for me would be to be able to test simpler aspects of I/O that can be done in a VCS terminal before launching the full script graphics. I have added the fusion 360 path to my environment, and I am using version 3.7.6 64 bit of Python on Windows 10
Hi @oafak ,
When we launch VS code through fusion 360 it allows us to run python scripts on python module loaded with Fusion.
So some of the internal fusion modules will be loaded by default there. But when we launch independent VCS and try to use separate python module even with valid fusion path. But as python module is not able to find fusion modules it will give you errors.
If my answer helped you, please use ACCEPT SOLUTION .
Also be generous with Likes! Thank you and enjoy!
@Anonymous it is not working that simple for me 😞
when i click (Debug) button from "Script and Add-Ins" window in Fusion 360, Nothing happen
when i click (Edit) button, also nothing happen, so i have to open VS Code manually !
Debugging the script form VS Code also doesn't work, it just stops at this line
then exit debugging mode when i am trying to step over or add any break points after this line
however, the only thing that works is "Run" button to execute script in Fusion 360
------------------------------------
Code is attached...
Hello,
Did you read all the answers in this thread?
Actually, you have to downgrade the Python plugin in VS Code to version 2020.6.91350.
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file
Hi Jerome,
I know you have a lot of experience using the API, but for me, it's just like it is for Moh_Samy clicking on debug does nothing but opening quickly a command windows, where it says installing extension. It does not start VS Code
I have Python extension 2020.6.91350 installed, as recommended
This has been working for me in the past, with the previous recommended Python extension, and an older version of Fusion, as well as an older version of VS Code
Right now, my versions are:
Fusion 360 2.0.8950
Windows 10 19042
VS Code 1.49.1
Well,I fully un-installed Fusion and reinstalled it. Now it works. Don't asl me why, but it may help some other people.
Thank you very much for your fast response ! I really appreciate that
I do read all the thread, but i noticed @Nilesh.Mohite recommend version 2019.9.34911 of python in VS code, so i do.
any way i installed the exact version you mentioned and now there is somehow communication between VS code and fusion.
Now, when i click "Edit" button in "Scripts and Add-Ins" window, it opens VS code automatically to edit the code
also when i click "Debug" button it do the same but don't start debugging.
when i try to click the debug button in VS code at the upper left corner it show error message:
"Invalid message : Session is not initialized yet"
and have a button called "Open Launch.json" which opens a file with the same name to be edited somehow
what should i do then ?
-------------------------------------------------------
VS code version: 1.49.1 (user setup)
VS code python extension version: 2020.6.91350
Fusion 360 version: 2.0.8950
windows version: Windows 10 (19041)
windows python version: 3.7.6
-------------------------------------------------------
As @JeromeBriot kindly said
you must have python extension version 2020.6.91350 in VS code. maybe because of new fusion360 updates need this extension version.
before that i was installing (2019.9.34911) and this was working well for me since ~2 months, but when i returned now, nothing work at all as you said (Edit & Debug) buttons in the (Scripts and Add-Ins) window don't work.
it just opens a "cmd" window saying "installing extension..." then disappear and nothing happen at all after this.
after installing this version ( 2020.6.91350) as @JeromeBriot mentioned, a link somehow re-established between fusion 360 and VS Code. now (Edit & Debug) buttons opens VS code window, but debugging still not work as i mentioned i the previous reply.
I hope you will solve this problem soon, and i will reply when it is solved for me.
HI @Moh_Samy ,
Now fusion supports latest vscode extensions and vscode versions.
A. Are you able to debug other sample script like Bottle.py ,Bolt.py ?
If yes then just copy this file with your script "TH Aluminium Poly Capacitor Sizes.manifest".
This file gets auto generated by fusion when you create new script using fusion. But some how if you relocated your script then you can copy the manifest file and rename to match your script name.
I have added same thing in zip attached.
B. If you are still facing some issue and not able to debug sample scripts also.
Please do following steps.
Please let me know if you need anymore help.
If my answer helped you, please use ACCEPT SOLUTION .
Also be generous with Likes! Thank you and enjoy!
I found out, last week, by accident, that Fusion 360 API now supports not only my Python 3.8.3, but also the latest Python extension 2020.8.109390! Thanks to Nilesh for confirming this. I was able to move to the newest version (previously installed) without re-installing Fusion 360, or Visual Studio Code. There is no need to ask users to downgrade to older versions or extensions any longer if this new compatibility with the API remains stable. Kudos to the Fusion 360 API team and the Python people for making this work. It is a joy to work in this environment!
Thanks you very much for your attention.
regretfully, this method doesn't work for me !
i have uninstalled every thing (Vs Code and Fusion 360 and python) then reinstalled every thing again and it is working for me well right now
now i have these versions:
Fusion 360 : 2.0.9011
Python : 3.7.6
VS Code : 1.50.0 (User Setup)
Python extension in VS code : 2020.6.91350
Windows : 10 (19041)
Can't find what you're looking for? Ask the community or share your knowledge.