Isprintable() not working

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())

Code Sample:

str = "asdfadfasdfadsf"
print(str.isprintable())

Clone link:
share a copy of your app

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.

OK… thanks. I think I’ll just send the string to a server module for now

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.

1 Like

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

15 round trips on a form while the user waits for the result is crippling.

It’s OK if done in the background with a timer, but doing them all in sequence is going to be very slow.

I’m in the US, and 15 round trips would take 5-10 seconds and make the form unusable.