Editor for .py files is now configurable

Until recently, when a developer clicked the Edit button in the module’s Reload & Test section, Slicer opened the Python file of the module using the program associated with Python files in the operating system settings.

However, sometimes the operating system settings did not have any program associated with Python files or it was not an editor, therefore this function did not open the .py file in an editor.

In recent Slicer Preview Releases, a new option is added in menu: Edit / Application Settings / Python / General: Editor for .py files.

If path to an editor executable (such as Visual Studio Code, PyCharm, …) is specified there then Slicer will open .py files are opened using this program instead of the operating system default.


Thanks for quick reply.
But I dont see the “Editor for .py files:” parameter at Python->General.

As I wrote above, the feature was introduced in recent Slicer Preview Releases. Download the Slicer Preview Release to get this option.

A post was split to a new topic: SurfaceWrapSolidify extension does not work in latest Slicer Preview Release

Thanks for that. On Linux with Slicer 5.4, I can use Sublime as my editor. Sadly, on macOS with preview Slicer 5.5 this does not work. Am I doing something wrong? Should I put something different to the path? I am very new to macOS so there might be a mistake on my side. Thanks for your help.

You need to specify the executable there. “For your convenience” macOS Finder hides the actual executable file path and just returns the path of the app bundle. You need to open the bundle (by right-clicking on it and choose to open contents), then locate the executable file, and then copy that path to the Slicer settings.

My impression is that macOS user experience designers are obsessed with trying to make things simpler for the crowds and they don’t care if that makes things really inconvenient for developers like you.

1 Like