Native Libraries in py.space

I’ve tried to create a demo of something using py.space. It works perfectly as an ordinary anvil app, but not as a pyspace widget.

It relies upon importing some stuff via cdn in native libraries and is refusing to do so. Is there some limitation here that I don’t know about?

Here’s the widget:

and here’s the original app that I’ve copied it from:

1 Like

Native Libraries isn’t available in py.space*. How are you doing the imports in the py.space widget? What happens if you attempt the same in the Anvil app?

py.space and Anvil use exactly the same runtime and app hosting infrastructure behind the scenes, so I would be very surprised to see the same code behaving differently in both!

(* actually, now I think of it, we probably don’t enforce that - if you opened the widget in Anvil and edited native libraries, the py.space editor might not notice you’d fiddled with it, and serve it anyway…)

I created the pyspace widget and then edited the resulting app in the ide to add the native libraries content.

That’s odd! Then it should be exactly the same app as you edited in the IDE! The only difference I can think of is perhaps the py.space template you’re using might be different to the Anvil one, in a way that’s messing with your native library? Afraid I’m out of the house atm so can’t check your app…

No hurry. I’ve probably done something stupid.

As I suspected, this was, once again, my own stupid damned fault. I’d forgotten to add a .js file into the assets that one of the lines in native libs expects to find. All good!