Hi, I have a test release for ELSE up in deken and I'm trying a new thing where it loads a tcl tk plugin when you load the library via the startup path. The plugin is an object browser that creates a drop menu when right clicking on a canvas, like the one I did for vanilla and you can get it. The release is marked as "else rc8 test" and you can get it.
The binary code is in https://github.com/porres/pd-else/blob/master/Classes/Source/else.c and you get with the download a couple of tcl files, which are https://github.com/porres/pd-else/blob/master/extra/else-browser.tcl and https://github.com/porres/pd-else/blob/master/extra/else_tree.tcl
It seemed to work fine for me and others, I tested on old macbook aur from 2013 with mojave. It doesn't work on a 2018 intel macbook pro with mojave as well, and gives this error.
The file is found and loaded,
*ELSE's object browser-plugin loaded via the 'else' binary*
but I get this tcl tk error right after
*(Tcl) INVALID COMMAND NAME: invalid command name ".popup" while executing"$mymenu add separator" (procedure "category_menu::create" line 3) invoked from within"category_menu::create .popup" ("eval" body line 55) invoked from within"eval [read [open [file join /Users/ale/Documents/Pd/externals/else else-browser.tcl]]]" ("uplevel" body line 51) invoked from within"uplevel #0 $docmds"*
The thing is that if I load it as a proper tcl tk plugin it works when laoding Pd, and it also works ok if I load the else binary not on the startup but with decalre, for instance...
To make things even crazier, the same macbook pro on another partition with monterey loads it just fine!
tested with Pd 0.52-2
realy lost here so I hope the wizards could help me
thanks
Am 12. Mai 2023 21:51:15 MESZ schrieb Alexandre Torres Porres porres@gmail.com:
within"category_menu::create .popup" ("eval" body line 55) invoked from within"eval [read [open [file join /Users/ale/Documents/Pd/externals/else else-browser.tcl]]]"
For starters, this is really not how you should try to load your gui-plugin. Instead use the `load_plugin_script` proc. (Speaking of which: note to myself to remove the "tcl" extension when calling this proc)
mfg.sfg.jfd IOhannes
but how can I use it? Simply trying to include 'load_plugin_script' gives me "symbol load_plugin_script not found"
I'm trying something like this in the setup
*char* plugin[MAXPDSTRING];
sprintf(plugin, "%s/else-browser.tcl", else_obj_class->c_externdir->s_name);
load_plugin_script(plugin);
Em sáb., 13 de mai. de 2023 às 08:04, IOhannes m zmölnig zmoelnig@iem.at escreveu:
Am 12. Mai 2023 21:51:15 MESZ schrieb Alexandre Torres Porres < porres@gmail.com>:
within"category_menu::create .popup" ("eval" body line 55) invoked from within"eval [read [open [file join /Users/ale/Documents/Pd/externals/else else-browser.tcl]]]"
For starters, this is really not how you should try to load your gui-plugin. Instead use the `load_plugin_script` proc. (Speaking of which: note to myself to remove the "tcl" extension when calling this proc)
mfg.sfg.jfd IOhannes
Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev
Am 13. Mai 2023 17:50:09 MESZ schrieb Alexandre Torres Porres porres@gmail.com:
but how can I use it? Simply trying to include 'load_plugin_script' gives me "symbol load_plugin_script not found"
It's a tcl-proc, not a C-function. From the C-side, call it via `pdgui_vmess`.
mfg.sfg.jfd IOhannes
ok, thanks! Now it works when I do:
char plugin[MAXPDSTRING]; sprintf(plugin, "%s/else-browser.tcl", else_obj_class->c_externdir->s_name); pdgui_vmess("load_plugin_script", "s", plugin);
and it loads fine on my old macbook air! Same issue remains though on my newer macbook pro... nothing really changed...
error is a bit different though. It now says
*UNHANDLED ERROR: invalid command name ".popup" while executing"$mymenu add separator" (procedure "category_menu::create" line 3) invoked from within"category_menu::create .popup" ("uplevel" body line 55) invoked from within"uplevel #0 $tclcode"FAILED TO LOAD /Users/ale/Documents/Pd/externals/else/else-browser.tcl-----------*
In both this way and the previous way I was trying to load the file, the error complains it can't fint the .tcl file, which is funny, because it is there, and also, it is able to find it if I don't use the startup call but just load the binary at some point later instead. Again, this is in mojave, same OS as I'm using in my macbook air, so it can't be the OS... to make things crazier, same macbook pro computer and the new code works in my monterey partition. Nothing really changed and doing it in a more proper way didn't help. It seems the issue is a bit more bizarre and Pd just can't see this file at startup somehow.
any new ideas and hints?
cheers
Em sáb., 13 de mai. de 2023 às 16:44, IOhannes m zmölnig zmoelnig@iem.at escreveu:
Am 13. Mai 2023 17:50:09 MESZ schrieb Alexandre Torres Porres < porres@gmail.com>:
but how can I use it? Simply trying to include 'load_plugin_script' gives me "symbol load_plugin_script not found"
It's a tcl-proc, not a C-function. From the C-side, call it via `pdgui_vmess`.
mfg.sfg.jfd IOhannes
Em sáb., 13 de mai. de 2023 às 17:27, Alexandre Torres Porres < porres@gmail.com> escreveu:
It seems the issue is a bit more bizarre and Pd just can't see this file at startup somehow.
no, not that really. It seems the issue is simply what it says "*invalid command name ".popup"*"
which doesn't really work at startup but works later or in my other partition with another OS or my other machine with the same OS
any new ideas and hints?
cheers
Em sáb., 13 de mai. de 2023 às 16:44, IOhannes m zmölnig zmoelnig@iem.at escreveu:
Am 13. Mai 2023 17:50:09 MESZ schrieb Alexandre Torres Porres < porres@gmail.com>:
but how can I use it? Simply trying to include 'load_plugin_script' gives me "symbol load_plugin_script not found"
It's a tcl-proc, not a C-function. From the C-side, call it via `pdgui_vmess`.
mfg.sfg.jfd IOhannes
On 5/14/23 15:46, Alexandre Torres Porres wrote:
Em sáb., 13 de mai. de 2023 às 17:27, Alexandre Torres Porres < porres@gmail.com> escreveu:
It seems the issue is a bit more bizarre and Pd just can't see this file at startup somehow.
no, not that really. It seems the issue is simply what it says "*invalid command name ".popup"*"
which doesn't really work at startup but works later or in my other partition with another OS or my other machine with the same OS
presumably because there is no .popup created yet. if you experience this "bizarre" behaviour on exactly the same version of Pd across multiple systems, then you are apparently running into some race condition. (after all: there are two separate applications starting up: Pd-core and Pd-GUI. issuing a command in your external's setup-function will send out a Tcl-command *very* early in the process (at least if you are loading the external on startup), when the Pd-GUI might not be fully initialized yet)
note however, that up to Pd-0.53, Pd created a single global .popup menu (for the right-click context menu). as of Pd-0.54 (that is: current git 'master'), this global .popup menu no longer exists (in order to fix [1303], and you obviously cannot use it.
gfmsa IOhannes
Em dom., 14 de mai. de 2023 às 16:12, IOhannes m zmölnig zmoelnig@iem.at escreveu:
presumably because there is no .popup created yet. if you experience this "bizarre"
behaviour on exactly the same version of Pd across multiple systems
just in one system and in one computer
, then you are apparently running into some race condition.
(after all: there are two separate applications starting up: Pd-core and Pd-GUI. issuing a command in your external's setup-function will send out a Tcl-command *very* early in the process (at least if you are loading the external on startup), when the Pd-GUI might not be fully initialized yet)
I thought about something like this because the error happens on the faster machine, which may load stuff faster
note however, that up to Pd-0.53, Pd created a single global .popup menu (for the right-click context menu). as of Pd-0.54 (that is: current git 'master'), this global .popup menu no longer exists (in order to fix [1303], and you obviously cannot use it.
Hmmm, yeah, I'm aware things are different in 0.54 and the object browser PR I sent does this differently.
So, I'm not sure I get it but I'm assuming this won't be an issue in the next version, right? Please confirm.
I can wait though, no problem. For now I'll just tell people to add else's folder to the search path in preferences-->path and I can name the .tcl file in order to load it as a tcl plugin like others.
cheers
gfmsa IOhannes
[1303] https://github.com/pure-data/pure-data/issues/1303 _______________________________________________ Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev
On 5/15/23 06:15, Alexandre Torres Porres wrote:
Em dom., 14 de mai. de 2023 às 16:12, IOhannes m zmölnig zmoelnig@iem.at escreveu:
presumably because there is no .popup created yet. if you experience this "bizarre"
behaviour on exactly the same version of Pd across multiple systems
just in one system and in one computer
not sur ewhat you mean here, but the nature of race-conditions is that they are hard to reproduce (across systems). a race condition might happen on one system (reproducibly), and not show up on another system at all.
So, I'm not sure I get it but I'm assuming this won't be an issue in the next version, right? Please confirm.
what would "not be an issue"? with Pd-0.54 the ".popup" will not be created any more at all, so if your code depends on such an item, it will fail. otoh, Pd-0.54 will replace the ".popup" with a window-specific "${win}.popup". this window-specific item will not be created until the window is created, so if your code depends on such an item to exist at startup time, it is likely to fail as well.
I can wait though, no problem. For now I'll just tell people to add else's folder to the search path in preferences-->path and I can name the .tcl file in order to load it as a tcl plugin like others.
ideally https://github.com/pure-data/pure-data/pull/1766 would be applied, in which case you just have to put an "else-plugin.tcl" into your "else" folder and it will be loaded automatically.
this will seamlessly integrate with your proposal (telling people to add the "else" folder to the path-preferences): it will just start to work automatically (for those who did not follow your instructions) whenever the PR is accepted.
in any case, please make sure that things keep working even if the GUI-plugin is not loaded (with degraded functionality obviously).
gmfsadr IOhannes
Em seg., 15 de mai. de 2023 às 05:08, IOhannes m zmölnig zmoelnig@iem.at escreveu:
not sure what you mean here, but the nature of race-conditions is that they are hard to reproduce (across systems). a race condition might happen on one system (reproducibly), and not show up on another system at all.
yup, on the same computer, it happens on mojave but not on monterey... on another older computer it loads on mojave.
what would "not be an issue"?
this whole problem of not being able to load this particular plugin with the newer structure.
with Pd-0.54 the ".popup" will not be created any more at all, so if your code depends on such an item, it will fail.
sure, it would need to be adapted, just like the PR to add an object browser to Vanilla has been adapted. For reference, see https://github.com/pure-data/pure-data/pull/1917
otoh, Pd-0.54 will replace the ".popup" with a window-specific "${win}.popup". this window-specific item will not be created until the window is created, so if your code depends on such an item to exist at startup time, it is likely to fail as well.
The only usage of 'popup' in #1917 is in the bottom with "*trace add execution ::pdtk_canvas::create_popup leave category_menu::create*"
And I just tested loading this file against the current master. No issue loading the plugin. So I am suspecting that this new structure and strategy solves the issue, right? Please confirm.
I can wait though, no problem. For now I'll just tell people to add
else's
folder to the search path in preferences-->path and I can name the .tcl file in order to load it as a tcl plugin like others.
ideally https://github.com/pure-data/pure-data/pull/1766 would be applied, in which case you just have to put an "else-plugin.tcl" into your "else" folder and it will be loaded automatically.
That will be indeed great, sure, but in the meantime I'll change the way to load this thing and wait for 0.54-0 to update the library to load this plugin without any issues and in a more convenient way.
Thanks