Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Snippets
  • Register
  • Sign in
  • ase ase
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 67
    • Issues 67
    • List
    • Boards
    • Service Desk
    • Milestones
  • Jira
    • Jira
  • Merge requests 28
    • Merge requests 28
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Activity
  • Create a new issue
  • Jobs
  • Issue Boards
Collapse sidebar

Do not update/delete: Banner broadcast message test data

Do not update/delete: Notification broadcast message test data

  • asease
  • asease
  • Issues
  • #171
Closed
Open
Issue created Oct 05, 2017 by username-removed-281462@mbarbry

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

Assignee
Assign to
Time tracking