racket/gui/base in sandboxes in places

28 views
Skip to first unread message

William J. Bowman

unread,
Oct 3, 2021, 4:05:54 PM10/3/21
to Racket Users
I'm trying to run sandboxes in places, but when the sandboxes need access to racket/gui (such as through 2htdp/universe), they get `cannot instantiate racket/gui/base' a second time`. I've tried initing racket/gui once in the server that starts the places, but this doesn't seem to work. (gui-available?) is still false in started places, and they still raise the exception when the sandbox tries to load the gui module.

I don't really need to run gui code in the sandbox, so I'm guessing the best workaround is to override `2htdp/universe` in the sandbox.

Anyone have either a solution, or a better workaround?

--
William J. Bowman

George Neuner

unread,
Oct 3, 2021, 5:54:14 PM10/3/21
to racket users
My (perhaps incorrect) understanding is that with dynamic (kernel
thread) places, only the foreground place can have a GUI.  I'm not sure
why the gui package won't load in a background place, but it may not
work right even if you can get it to load.

Just a suggestion: you might try using Paulo Matos's "Loci" package - it
simulates dynamic places using separate processes.  With Loci, the place
is foreground in its own process, so it /might/ allow racket/gui to work.

https://pkgs.racket-lang.org/package/loci


Hope this doesn't lead down a rabbit hole.
George
Reply all
Reply to author
Forward
0 new messages