Ohh, now I get it. Apparently you must have fiddled with the document settings and set the data engine to use Python 2 instead of 3. Of course, that’s a much older version of the language and as such it doesn’t support many of the features used in my code. Switch it over to Python 3 and everything works fine again. That also explains why creating a new doc worked, as Python 3 is the default setting.
Ahaaa, yes that explains it! Thanks!
But, looking into the local copy running on grist-electron (desktop) it seems there is no setting for selecting Data Engine, so maybe it defaults to Python2?
Or if it is a grist-electron global setting? Need to investigate… Cumbersome if local copies are not compatible with online copies.
That’s a good question. I don’t really know much about Grist electron. Maybe one of the devs might chime in…?
According to the docs you need editing rights. Could it be an access rules thing?
OK, I just confirmed that Grist Desktop ships with a single Python version (via Pyodide), with no option to switch. If you turn off sandboxing, it defaults to 3.11.9, though to get your current version you can just add this formula to a blank doc:
import sys
sys.version
Hmm looking a bit closer at this, I see that if you do this:
- Create a document using Grist Desktop (automatically uses Python 3, all Desktop has)
- Import that document onto Grist Lab’s hosted service (supports Python 3 by default, and Python 2 for old docs)
Then the document ends up using Python 2. That’s silly. We’ll get that fixed - sorry!
(you can fix things yourself on the hosted service by going into the imported document and manually setting it to use Python 3, but you shouldn’t have to)





