Commit c55636e2 authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Refine error message on reading file.

parent 7b767ce4
...@@ -145,11 +145,11 @@ class ForceField(object): ...@@ -145,11 +145,11 @@ class ForceField(object):
# TODO: Also handle case where fallback to 'data' directory encounters problems, # TODO: Also handle case where fallback to 'data' directory encounters problems,
# but this is much less worrisome because we control those files. # but this is much less worrisome because we control those files.
msg = str(e) + '\n' msg = str(e) + '\n'
if hasattr(file, 'close'): if hasattr(file, 'name'):
filename = file.name filename = file.name
else: else:
filename = file filename = str(file)
msg += 'ForceField.loadFile() encountered an error reading file: %s' % filename msg += "ForceField.loadFile() encountered an error reading file '%s'\n" % filename
raise Exception(msg) raise Exception(msg)
root = tree.getroot() root = tree.getroot()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment