Command doesn't work via package manager

Hey all, I published a plugin for my python command. However, after I install it, it doesn’t pop up the form like when I run the script via the ScriptEditor. I installed it via the package manager. What is the best way to debug this? Thanks!


class MainForm(forms.Form):
   ...

def main():
    if sc.sticky.has_key(MAIN_FORM):
        form = sc.sticky[MAIN_FORM]
        form.Show()
    else:
        dialog = MainForm()
        dialog.Owner = Rhino.UI.RhinoEtoApp.MainWindow
        dialog.Show()
        sc.sticky[MAIN_FORM] = dialog

if __name__ == "__main__":
    main()

can you try instead:

dialog.Owner = Rhino.UI.RhinoEtoApp.MainWindowForDocument(sc.doc)

3 Likes

Thank you! It works consistent now with Rhino 8, but I still don’t see anything after I run the command in Rhino 7.

Ah it turns out Rhino7 doesn’t like these code:

current_dir = os.path.dirname(os.path.abspath(__file__))
log_file = os.path.join(current_dir, 'reimagic.log')

What’s the error on this code in Rhino 7?

There’s no crash nor exception. How do I check the error when running it as a command?

Run RhinoCodeLogs and check the contents for error messages. The most recent logs are at the bottom. Also maybe add verification code into your script to check the constructed path and print messages if path is not correct.

1 Like