Skip to content

Support parsing DFPT results from the castep file #2

@amundmr

Description

@amundmr

if 'CASTEP version' in line:

It seems that if the version finding fails, the whole reader fails. This is because unless the version is found, no "version" variable is made, so the next if statement fails.

Can this be avoided by using an else statement and setting the version to nan?

Traceback (most recent call last):
File ".\importer.py", line 95, in
data = cp.readers.read_castep_file(fn1)
File "c:\users\amund\documents\megasync\prosjekter\castep-parse\castep_parse\utils.py", line 391, in decorated
return func(lines, *args, **kwargs)
File "c:\users\amund\documents\megasync\prosjekter\castep-parse\castep_parse\readers.py", line 64, in read_castep_file
run = parse_castep_run(run_str, run_idx)
File "c:\users\amund\documents\megasync\prosjekter\castep-parse\castep_parse\readers.py", line 703, in parse_castep_run
header = parse_castep_file_header(header_str)
File "c:\users\amund\documents\megasync\prosjekter\castep-parse\castep_parse\readers.py", line 866, in parse_castep_file_header
if not version:
UnboundLocalError: local variable 'version' referenced before assignment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions