as my plugin become complex with thread management and so on I setup an Pycharm IDE with a local installation of Octoprint on my Windows Laptop instead of testing it on my Pi. But I ask me how at best set a breakpoint to my plugin which is under the AppData folder in windows. As I am new to Python and also Pycharm hopefully you can give me a hint to get the plugin debugging running and also about the project structure with the plugins. I followed the guide here: Setting up a Development environment β OctoPrint master documentation
Actual situation:
Starting OctoPrint in Pycharm is possible and a debugger could be attached, breakpoint working fine
Did not know how to set a breakpoint in my plugin?
If you have the debug configuration for OctoPrint, this will work too for your plugin.
Open the plugin's folder as the Pycharm project, and configure the debug settings for this to run OctoPrint (Note: You can also attach it to OctoPrint, but I find this more of a pain).
Then to add a breakpoint, click:
Then when you run from this project, you should be fine to debug and hit the breakpoints.
I tried to add the folder (within AppData) but the breakpoints are not reached. (would be nice so set breakpoints in Octoprint). I also tried like you advised creating a new project with the plugin folder but it shows the same behaviour. Also I cannot configure the virtual env. but Octoprint is starting.
The second one is how I use it. The key is that you have to configure the virtual environment and the run/debug configuration in that project, then run OctoPrint from there, it won't stop on breakpoints if you run OctoPrint outside the project that has the breakpoints in.
Now it is running fine, many thanks. Perhaps this should be added in the official development doc. It is the same with community edition.
To understand Pycharm Debugging it is still interesting for my why all other variants like adding the folder to the OctoPrint project does not work. This solution does use the same virt. env. and configuration. Actually I copied it to the project contains my plugin only and it is running well!? What is the dfference?
Another problem...only sometimes I get an error with the external program calls that are recommended by the Octoprint guide. As it is running fine mostly I think it is not a general problem. Do you know this perhaps?
05:54 Error running 'cleanup': Executable is not specified
It seems that the variable %ModuleSdkPath% is empty.