[ase-users] namespace collision in io module with Python 2.7

Ask Hjorth Larsen askhl at fysik.dtu.dk
Thu Sep 1 21:51:56 CEST 2011


On Thu, 1 Sep 2011, Nichols A. Romero wrote:

> This is for the gpaw_custom_hdf5 branch. Yes, the test directory has an io directory
> which trunk does not have.
>
> Nichols A. Romero, Ph.D.
> Argonne Leadership Computing Facility
> Argonne National Laboratory
> Building 240 Room 2-127
> 9700 South Cass Avenue
> Argonne, IL 60490
> (630) 252-3441

That makes the statement 'import io' a relative import which causes the 
standard library to grab the wrong io module or file.  A bad design 
decision on Python's part which I believe is fixed in Python3.  For now 
the solution is not to name modules and directories called io.py or io/ if 
one expects to run a Python interpreter in that directory.

Regards
Ask



More information about the ase-users mailing list