Error message in io.read unclear
Hi,
While trying to read an xyz file I got the following error,
None
Traceback (most recent call last):
File "xyz2fdf.py", line 31, in <module>
atoms = io.read(fname)
File "/media/marc/MSI-HDD/programs/ase_mbpt_lcao/ase/ase/io/formats.py", line 423, in read
io = get_ioformat(format)
File "/media/marc/MSI-HDD/programs/ase_mbpt_lcao/ase/ase/io/formats.py", line 201, in get_ioformat
initialize(format)
File "/media/marc/MSI-HDD/programs/ase_mbpt_lcao/ase/ase/io/formats.py", line 177, in initialize
_format = format.replace('-', '_')
AttributeError: 'NoneType' object has no attribute 'replace'
This error was caused because no format where recognized, my code was the following,
import ase.io as read
atoms = io.read("x123")
I figured out quite fast my mistake, but I think the error message should be more clear.
Something like the following should give a nicer message (ase/io/formats.py, line 421),
format = format or filetype(filename)
if format is None:
raise ValueError("file format missing or not recognize.")
io = get_ioformat(format)
What do you think?
Marc