mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 10:15:11 +00:00
Catch ValueError because IronPython raises it on bad filename #75
This commit is contained in:
parent
eb59047a88
commit
59d3a9d178
3 changed files with 9 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ import collections
|
|||
__VersionInfo = collections.namedtuple('VersionInfo',
|
||||
('major', 'minor', 'micro'))
|
||||
|
||||
__version__ = '0.0.23'
|
||||
__version__ = '0.0.24'
|
||||
__version_info__ = __VersionInfo(*(map(int, __version__.split('.'))))
|
||||
|
||||
del collections, __VersionInfo # Avoid polluting the namespace
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ except ImportError:
|
|||
import __builtin__ as builtins
|
||||
|
||||
from .third_party import six
|
||||
from . import utils
|
||||
|
||||
ipython_filename_pattern = re.compile('^<ipython-input-([0-9]+)-.*>$')
|
||||
|
||||
|
|
@ -109,7 +110,7 @@ def get_source_from_frame(frame):
|
|||
try:
|
||||
with open(file_name, 'rb') as fp:
|
||||
source = fp.read().splitlines()
|
||||
except (OSError, IOError):
|
||||
except utils.file_reading_errors:
|
||||
pass
|
||||
if source is None:
|
||||
source = UnavailableSource()
|
||||
|
|
|
|||
|
|
@ -30,3 +30,9 @@ class WritableStream(ABC):
|
|||
return _check_methods(C, 'write')
|
||||
return NotImplemented
|
||||
|
||||
|
||||
file_reading_errors = (
|
||||
IOError,
|
||||
OSError,
|
||||
ValueError # IronPython weirdness.
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue