Skip to content

Commit

Permalink
[fileio] Add show warnings flag on load
Browse files Browse the repository at this point in the history
Closes #305
  • Loading branch information
mpsonntag committed Nov 16, 2018
1 parent 3f11ff9 commit 3654d37
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions odml/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
from .tools.odmlparser import ODMLReader, ODMLWriter


def load(filename, backend="xml"):
def load(filename, backend="xml", show_warnings=True):
"""
Load an odML document from file.
:param filename: Path and filename from where the odML document
is to be loaded and parsed.
:param backend: File format of the file containing the odML document.
The default format is XML.
:param show_warnings: Toggle whether to print warnings to the command line.
:return: The parsed odML document.
"""
if not os.path.exists(filename):
msg = "File \'%s\' was not found!" % \
(filename if len(filename) < 20 else "...%s" % filename[19:])
raise FileNotFoundError(msg)

reader = ODMLReader(backend)
reader = ODMLReader(backend, show_warnings)
return reader.from_file(filename)


Expand Down

0 comments on commit 3654d37

Please # to comment.