numpy.load() leads to ImportError when dolfin is imported

Bug #956939 reported by Anders E. Johansen
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
Undecided
Johan Hake

Bug Description

Using the numpy.load() module in a program which has imported dolfin leads to the following error message:

ImportError: cannot import name DEFAULT_BUFFER_SIZE

This works fine on a stable 1.0 release, but crashes with trunk.

The following program can recreate the error:

import dolfin as d
import numpy as np

filename = "a.npy"
a = np.array([0,1,2])
np.save(filename, a)
a = np.load(filename)

Anders

Related branches

Revision history for this message
Anders E. Johansen (andersej) wrote :

This was introduced in revision 6537, so it's probably related to the splitting of the SWIG interface.

Anders

Revision history for this message
Johan Hake (johan-hake) wrote :

I am not sure why this happens. However prepending the following line to your script fixes the problem.

import io

What fails is the import of the io module after dolfin has been imported. Import that before dolfin and you are fine.

Changed in dolfin:
status: New → Won't Fix
assignee: nobody → Johan Hake (johan-hake)
milestone: none → 1.1.0
Johan Hake (johan-hake)
Changed in dolfin:
status: Won't Fix → Fix Committed
Changed in dolfin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.