[Paraview] Problem reading a numpy NPZ file in ParaView 5.2.0 on Windows

Cory Quammen cory.quammen at kitware.com
Fri Jan 6 14:36:53 EST 2017


Guillaume,

Thanks for the report. I looked into this and I think I know what is going on.

In ParaView 5.2.0, we reduced the number of Python modules that
shipped with the ParaView binaries. One of the modules not included
was the "compiler" module. Now, Numpy checks to see if the "compiler"
module is available, and if it isn't, uses the "ast" module instead to
parse some file header data. However, Numpy doesn't correctly handle
the results produced by using ast.parse to parse the header data.

ParaView 5.1.2 shipped with the "compiler" module, which is why it
worked for you in the past. We'll have to add it back for the next
release. I've added an issue to track here:

https://gitlab.kitware.com/paraview/paraview-superbuild/issues/43

Thanks again for the report.

Cory

On Fri, Jan 6, 2017 at 1:39 AM, Guillaume Jacquenot
<guillaume.jacquenot at gmail.com> wrote:
> I want to report that this bug also occurs on the Linux version of ParaView
> 5.2.0
>
> 2017-01-04 10:14 GMT+01:00 Guillaume Jacquenot
> <guillaume.jacquenot at gmail.com>:
>>
>> Hello everyone,
>>
>> I want to report a possible bug.
>>
>> I have a Python script that creates data, exports data in a numpy NPZ
>> file, and reads it later in a ProgrammableFilter.
>>
>> With ParaView 5.1.2, everything works fine.
>>
>> However, when I try it with ParaView 5.2.0, I have a weird reading error.
>>
>> I have checked the 'About ParaView' window, but see no real difference
>> between
>> the two versions.
>>
>> If I try to import the PV 5.2.0 npz generated file in another Python
>> interpreter with anoter numpy version (1.11.3), I have no problem.
>>
>> So I guess, the PV 5.2.0 npz generated files are correct, but there is a
>> problem accessing its content from PV 5.2.0
>>
>> Here is a script that reproduces the bug. It is to be run from the PV
>> interpreter.
>>
>>     import os
>>     import tempfile
>>     import numpy as np
>>     outputFilename = os.path.join(tempfile.mkdtemp(), 'dummy.npz')
>>     varName='Time'
>>     np.savez(outputFilename, **{varName:np.random.rand(3,4)})
>>     d = np.load(outputFilename)
>>     time = d[varName]
>>     d.close()
>>     os.remove(outputFilename)
>>     print('Success PV can create a NPZ file and read its content : ' +
>> outputFilename)
>>
>> Here is the message error on Windows with PV 5.2.0
>>
>> >>> Traceback (most recent call last):
>>   File "<string>", line 8, in <module>
>>   File
>> "D:\ParaView-5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\lib\npyio.py",
>> line 250, in __getitem__
>>     return format.read_array(bytes)
>>   File
>> "D:\ParaView-5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\lib\format.py",
>> line 437, in read_array
>>     shape, fortran_order, dtype = read_array_header_1_0(fp)
>>   File
>> "D:\ParaView-5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\lib\format.py",
>> line 334, in read_array_header_1_0
>>     d = safe_eval(header)
>>   File
>> "D:\ParaView-5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\lib\utils.py",
>> line 1132, in safe_eval
>>     return walker.visit(ast)
>>   File
>> "D:\ParaView-5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\lib\utils.py",
>> line 980, in visit
>>     return meth(node, **kw)
>>   File
>> "D:\ParaView-5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\lib\utils.py",
>> line 987, in visitExpression
>>     for child in node.getChildNodes():
>> AttributeError: 'Expression' object has no attribute 'getChildNodes'
>>
>> Guillaume Jacquenot
>>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the ParaView mailing list