FIXED: Why do I get this error only the first time I run the script?

Sorry for the generic title …

I have a widget button with the following in the OffToOn Script:

p = ui.panes.createFloating(type=PaneType.NETWORKEDITOR, name="Output"); p.owner = getattr(op,me.name)

The first time I press the button, I get the following error

  File "/project1/perform_ui/container1/perform_ui/output/valuesParexec", line 14, in onValueChange
td.tdError: File "</project1/perform_ui/container1/perform_ui:p = ui.panes.createFloating(type=PaneType.NETWORKEDITOR, name="Output"); p.owner = getattr(op,me.name)>", line 1
AttributeError: 'td.Shortcut' object has no attribute 'launch'
Results of run operation resulted in exception.

…and it opens a floating network pane to the root of the project…

But then, if I press the button again, it works fine, and it opens the correct path in a floating pane.

How do I make it work the first time every time?

I just navigated to where these buttons are as well as to /project1/perform_ui/container1/perform_ui/output/valuesParexec, and it seems that just by the act of looking at them, they don’t throw an error on first execute.

Gonna change this to a bug, as it seems there’s an inconsistency somewhere under the hood (and also it didn’t use to happen several builds ago).

By widget-button you mean a button from the widgets from the palette or just like a regular button that you can place via the op-create dialog?
Best would be to create a simple file and upload it. Pinging @Ivan

Yes, hence the use of the OffToOn Script.

Here’s a fresh .toe that displays the same issue

popup-fails-first-time.toe (18.2 KB)

To reproduce, simply click the button called ‘base1’, and the floating network will open to project root. Then, press the button again, and it’ll open the Base called ‘base1’ as expected.

I see it. Def weird! Can’t find anything referring to “launch”!

1 Like

I’ve added this weirdo bug to our queue :slight_smile: Very curious what’s going on here.

1 Like

So still investigating, but as a work around if you add ui.refresh() after the pane creation, it allows things to settle down before continuing with the script.
It’s a timing issue with refreshing the UI and the python that executes.
Cheers

p = ui.panes.createFloating(type=PaneType.NETWORKEDITOR, name=“Output”); ui.refresh(); p.owner = getattr(op,me.name); print(‘me’, me.path)

2 Likes

Okay this will now be fixed in builds 2022.30360 and later.
It also had to do with tscript DATs being executed between python scripts.

Cheers.

2 Likes