##// END OF EJS Templates
Cleaner fix for qt execute_file bug:...
Jonathan March -
Show More
@@ -277,18 +277,13 b' class IPythonWidget(FrontendWidget):'
277 277
278 278 # Perhaps we should not be using %run directly, but while we
279 279 # are, it is necessary to quote or escape filenames containing spaces
280 # or quotes. As much as possible, we quote: more readable than escape.
281 if '"' in path:
282 if "'" in path:
283 # In this case, because %run 'a\'b"c.py' fails, we must escape
284 # all quotes and spaces.
285 for c in '" \'':
286 path = path.replace(c, '\\'+c)
287 else:
288 path = "'%s'" % path
289 elif ' ' in path or "'" in path:
290 path = '"%s"' % path
291
280 # or quotes. Note that in this context, because run uses posix
281 # parsing, we can escape double quotes in a double quoted filename,
282 # but can't escape singe quotes in a single quoted filename.
283 if "'" in path:
284 path = '"%s"' % path.replace('"', '\\"')
285 elif ' ' in path or '"' in path:
286 path = "'%s'" % path
292 287 self.execute('%%run %s' % path, hidden=hidden)
293 288
294 289 #---------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now