I’m trying to get non zero padded hours (%-H and %-I) out of datetime’s strftime(), but getting an error in the Output panel:
ValueError: invalid format string
at /lib/lib-python/3/datetime.py, line 236
called from /lib/lib-python/3/datetime.py, line 785
zero padded versions like %H and %I work fine. I know %-H and %-I are variously tagged as being platform specific. Any ideas what the implementation is here?
Thanks!
Ken
The implementation is Skulpt, a python interpreter written in javascript. That’s what enables you to write Python code but have it executed by a browser.
It has a great deal, but not all, of the standard library implemented. My guess would be that it’s implementation of the datetime module doesn’t include those formats.
Anvil employs more than one of its major contributors!
Thanks Owen. I’m actually trying to run that code in a Server module. Does Anvil use Skulpt for the server-side as well?
Cheers,
Ken
Ah. No, that’s a full blown, ordinary python environment! Not sure which implementation.
A long time ago, I read that the Free and Paid server-side implementations were different from each other. That may still be the case.
1 Like
Ended up stripping the leading zeros myself, didn’t make sense to try and get something so implementation-specific to work.
1 Like