Closed nathanielatom closed 3 years ago
base64.encodestring has been deprecated since python3.1. It still existed in python 3.8, seems it was removed in 3.9. Damn python devs don't understand that minor version increments don't introduce breaking changes...
The quick and dirty fix is to define it in your code before invoking pscript:
import base64
base64.encodestring = base64.encodebytes
base64.decodestring = base64.decodebytes
from pscript import py2js
That should be it. The docs say encodestring is an alias of encodebytes, and my quick test indicates they return the same type (a bytes object rather than a string). If the return value were different then you might need to transform it between the two, but that doesn't seem to be the case.
Note: I have no affiliation with pscript. Just answering on my python knowledge. If pscript is still being maintained, the devs may want to fix this so the above mitigation is no longer necessary.
Hope this helps.
python devs don't understand that minor version increments don't introduce breaking changes...
I don't think that Python uses semver versioning. Python does occasionally break backwards compatibility in dot-releases.
the devs may want to fix this so the above mitigation is no longer necessary.
Good point. I'll add a CI build for py39 and make sure it works again. There may be other problems, since the ast spec can also be changed between Python versions.
done! will release in a minute
In Python 3.9.1
from pscript import py2js
results in