What I’m trying to do:
Determine if a string contains non-printable characters. Both python 2 .printable and python 3 .isprintable() are returning an attribute error like this:
AttributeError: ‘str’ object has no attribute ‘isprintable’
What I’ve tried and what’s not working:
str = “asdfadfasdfadsf”
print(str.isprintable())
It works on the server, it’s missing on the client.
You can convert this post into a feature request, asking for isprintable to be added to Skulpt, but in the mean time you will need to create your own solution.
That works, but it will be thousands of times slower.
Just make sure you don’t call that function many times and trigger one round trip every time you call it.
For example, if you call it inside a loop, you could use 2 loops, one to get the list of strings you want to call that function on, then you call a server function with the list of strings, the server function returns a list of results, and the second cycle knows the result of each call previously executed on the server.
I’m sending a dictionary with all my elements that I’m checking… so it’s one trip per dictionary, and the list of dictionaries from the front end is usually less than 15