Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pickle.load and pickle.loads fail #443

Closed
peterhinch opened this issue Sep 1, 2021 · 1 comment
Closed

pickle.load and pickle.loads fail #443

peterhinch opened this issue Sep 1, 2021 · 1 comment

Comments

@peterhinch
Copy link
Contributor

peterhinch commented Sep 1, 2021

Using code loaded with upip on the Unix build, I get

MicroPython v1.16-243-gd608d0ed7 on 2021-08-29; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import pickle
>>> with open('20210831', 'r') as f:
...     a = pickle.load(f)

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/adminpete/.micropython/lib/pickle.py", line 11, in load
  File "/home/adminpete/.micropython/lib/pickle.py", line 15, in loads
AttributeError: 'str' object has no attribute 'decode'
>>> 

Commenting out line 15 fixes the problem with my data.

There is another issue in that the code downloaded does not match that in micropython-lib. Both have the error, but in the micropython-lib version it is on a different line. While the hack has fixed my immediate problem it would be interesting to know why these versions differ and which is correct.

@peterhinch
Copy link
Contributor Author

This error has gone away with firmware version 1.17 so I'll close this.

I'm still concerned that upip can produce different versions from modules in micropython-lib. I thought this was fixed some time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant