Error message lost with compiled commands

script
python
rhino5
compiler

#1

Hi everyone,

I have created a Python script and the way to make it work is the following:

  • When I click on the GUI button that I created or when I type the command name, it launches the compiled command launch_plugin.py (compiled in the .RHP)

  • This function launch_plugin.py only starts another script stored in plugin.dll (in the plugin folder, containing the core of my script)

  • When I have an error in my script (plugin.dll), I don’t get the error popup window (useful for debugging)

  • However if I go in RunPythonScript and Run launch_plugin.py, then I retrieve correctly the error popup windows

Do you know a way to retrieve those error messages using the compiled command instead of the Python file?

Best regards,
Nathan


(Steve Baer) #5

What does the “error popup” window look like? I’m a little confused and could use a picture.


#6

Right that wasn’t really clear :wink: I’m talking about classical python error message like:

image

I got this kind of message when I launch RunPythonScript > Run > launch_plugin.py (which is quite useful), but when launch_plugin.py is compiled in the RHP and the plugin is launched through the command (here launch_plugin), then this message disappear.

Is there a way to retrieve those messages when launched through command?

Best regards,
Nathan


(Steve Baer) #7

It’s not built in, but you should be able to use try/except blocks in python and the print the error message in the exception or show a dialog like the one that RunPythonScript does for you.


#8

Alright, thank you the try/except will work I think. It looks that, anyhow, the error message is absorbed when the command is compiled.

Thanks!
Nathan


(Giulio Piacentino) #9

As a side comment, if you are able to do anything, you should never let exceptions be silenced without action. Unless they really do not show a problem in the code, some sort of message should reach the user.