-
Notifications
You must be signed in to change notification settings - Fork 11
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Unhandled exception while importing and running script" #16
Comments
hmm. It looks like importlib.util.spec_from_file_location is returning None when creating an import spec for the script that's being run. I was able to reproduce this if I created a script with a non-standard extension (e.g. no extension) and overrode the file type in IDEA, and tried to run that. Does the script you're trying to run have a non-standard file extension or anything? I just pushed JesusFreke/fusion_idea_addin@a4d43cb which fixes the problem for that specific case at least. |
Hey, thanks for the quick response!
When I debug, I just see
|
Maybe I am missing something here - Are Fusion addons even supported? |
When running/debugging from IDEA/PyCharm, it will import the script into Fusion's python environment, run the "run" method, and then disconnect once the run method returns. I'm not actually sure what happens if you try to register for events or add buttons or stuff, like an add-in normally would. Since the add-in code is actually running in the context of the fusion_idea_addin as far as Fusion is concerned, I would guess it should probably work, but the events and such would just be associated with the fusion_idea_addin addin. Another approach would be to install your add-in as an actual add-in in fusion, and then set a breakpoint in an event handler or whatever in IDEA/PyCharm, and attach to the fusion process (Run->Attach to process in IDEA). Then, when the event is triggered, it should hit the breakpoint in IDEA/PyCharm and you can continue debugging from there. |
@JesusFreke I see, makes sense!
I somehow can't get PyCharm to connect to the Fusion process like VSCode does, no matter what I do. |
I don't know much/anything about how python debugging works, but I suspect the "Debug" button within Fusion starts a debugging server to which VSCode then connects. No idea how to set this up in pycharm though. Through the "Attach to Process.." dialog in PyCharm, I cannot connect to any process |
Hmm. Attach to process works for me in pycharm. First, make sure fusion 360 support is enabled for the project (Settings -> Languaged & Frameworks -> Fusion 360 -> Fusion 360 Support Enabled). Then Run->Attach to Process, and you should see the fusion process in the "Fusion 360 Processes" section And then, when it attaches, this is the console output:
|
@JesusFreke |
Fusion throws this error at me when running / debugging:
The text was updated successfully, but these errors were encountered: