diff --git a/mt940/__about__.py b/mt940/__about__.py index 4f70bd5..6397d4d 100644 --- a/mt940/__about__.py +++ b/mt940/__about__.py @@ -6,7 +6,7 @@ statistics and manipulation. '''.strip().split()) __email__ = 'wolph@wol.ph' -__version__ = '4.13.0' +__version__ = '4.13.1' __license__ = 'BSD' __copyright__ = 'Copyright 2015 Rick van Hattem (wolph)' __url__ = 'https://github.com/WoLpH/mt940' diff --git a/mt940/parser.py b/mt940/parser.py index 46878a9..fa5ae5d 100644 --- a/mt940/parser.py +++ b/mt940/parser.py @@ -40,9 +40,15 @@ def parse(src, encoding=None): :rtype: Transactions ''' + def safe_is_file(filename): + try: + return os.path.isfile(src) + except ValueError: # pragma: no cover + return False + if hasattr(src, 'read'): # pragma: no branch data = src.read() - elif os.path.isfile(src): + elif safe_is_file(src): return parse(open(src, 'rb').read()) elif hasattr(src, 'decode'): exception = None