Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions IPython/core/magics/osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from IPython.utils.process import abbrev_cwd
from IPython.utils.terminal import set_term_title
from traitlets import Bool
from warnings import warn


@magics_class
Expand All @@ -48,8 +49,15 @@ def __init__(self, shell=None, **kwargs):
winext = os.environ['pathext'].replace(';','|').replace('.','')
except KeyError:
winext = 'exe|com|bat|py'

self.execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
try:
self.execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
except re.error:
warn("Seems like your pathext environmental "
"variable is malformed. Please check it to "
"enable a proper handle of file extensions "
"managed for your system")
winext = 'exe|com|bat|py'
self.execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)

# call up the chain
super().__init__(shell=shell, **kwargs)
Expand Down