##// END OF EJS Templates
BUG: Improve hack. Issue #755. execute_file fails if filename has spaces
jdmarch -
Show More
@@ -253,6 +253,17 b' class IPythonWidget(FrontendWidget):'
253 if sys.platform == 'win32':
253 if sys.platform == 'win32':
254 path = os.path.normpath(path).replace('\\', '/')
254 path = os.path.normpath(path).replace('\\', '/')
255
255
256 # Perhaps we should not be using %run directly, but while we
257 # are, it is necessary to quote filenames containing spaces.
258 if ' ' in path:
259 if '"' not in path:
260 path = '"%s"' % path
261 elif "'" not in path:
262 path = "'%s'" % path
263 else:
264 raise ValueError("Can't run filename containing both single "
265 "and double quotes: %s" % path)
266
256 self.execute('%%run %s' % path, hidden=hidden)
267 self.execute('%%run %s' % path, hidden=hidden)
257
268
258 #---------------------------------------------------------------------------
269 #---------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now