8000 Masked Array load() fails on python3 · Issue #10189 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Masked Array load() fails on python3 #10189

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

Closed
lfini opened this issue Dec 10, 2017 · 3 comments
Closed

Masked Array load() fails on python3 #10189

lfini opened this issue Dec 10, 2017 · 3 comments

Comments

@lfini
Copy link
lfini commented Dec 10, 2017

numpy.ma.load() fails on files generated bu numpy.ma.dump() in python3. See the following code:

from __future__ import print_function
import sys
import numpy as np

print("Python version:", sys.version)
print("Numpy version:", np.version.full_version)

mma = np.ma.ones((4,4))
mma.dump("mma.dat")

mmb = np.ma.load("mma.dat")

And now let's run it:

laptop:~/py/Varie/testNPdump$ python testMAdump.py 
Python version: 2.7.12 (default, Nov 20 2017, 18:23:56) 
[GCC 5.4.0 20160609]
Numpy version: 1.13.3

Now with python3:

lfini@lfini-laptop:~/py/Varie/testNPdump$ python3 testMAdump.py 
Python version: 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609]
Numpy version: 1.13.3
Traceback (most recent call last):
  File "testMAdump.py", line 11, in <module>
    mmb = np.ma.load("mma.dat")
  File "/usr/local/lib/python3.5/dist-packages/numpy/ma/core.py", line 7868, in load
    return pickle.load(F)
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
@charris
Copy link
Member
charris commented Dec 10, 2017

AFAICT, this doesn't work in Python 2 either, check the load result. IIRC, there has been some discussion about removing those masked array functions.

@eric-wieser
Copy link
Member

Discussion is at #10045

@eric-wieser
Copy link
Member
eric-wieser commented Dec 10, 2017

This is a duplicate of #5491, so we should continue discussion there.

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

No branches or pull requests

3 participants
0