Skip to content
Snippets Groups Projects
Commit 518630c2 authored by marco's avatar marco
Browse files

bail out if io.LoadPDB doesn't find anything useful in the file

Fixes BZDNG-160

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2667 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 39c2d538
No related branches found
No related tags found
No related merge requests found
...@@ -105,6 +105,8 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=False, ...@@ -105,6 +105,8 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=False,
reader.Import(ent, restrict_chains) reader.Import(ent, restrict_chains)
conop_inst.ConnectAll(builder, ent, 0) conop_inst.ConnectAll(builder, ent, 0)
ent_list.append(ent) ent_list.append(ent)
if len(ent_list)==0:
raise IOError("File doesn't contain any entities")
PDB.PopFlags() PDB.PopFlags()
return ent_list return ent_list
else: else:
...@@ -112,6 +114,8 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=False, ...@@ -112,6 +114,8 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=False,
if reader.HasNext(): if reader.HasNext():
reader.Import(ent, restrict_chains) reader.Import(ent, restrict_chains)
conop_inst.ConnectAll(builder, ent, 0) conop_inst.ConnectAll(builder, ent, 0)
else:
raise IOError("File doesn't contain any entities")
PDB.PopFlags() PDB.PopFlags()
return ent return ent
except: except:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment