Show More
@@ -254,15 +254,16 b' class IPythonWidget(FrontendWidget):' | |||
|
254 | 254 | path = os.path.normpath(path).replace('\\', '/') |
|
255 | 255 | |
|
256 | 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 |
|
|
|
262 | path = "'%s'" % path | |
|
263 | else: | |
|
257 | # are, it is necessary to quote filenames containing spaces or quotes. | |
|
258 | # Escaping quotes in filename in %run seems tricky and inconsistent, | |
|
259 | # so not trying it at present. | |
|
260 | if '"' in path: | |
|
261 | if "'" in path: | |
|
264 | 262 | raise ValueError("Can't run filename containing both single " |
|
265 | 263 | "and double quotes: %s" % path) |
|
264 | path = "'%s'" % path | |
|
265 | elif ' ' in path or "'" in path: | |
|
266 | path = '"%s"' % path | |
|
266 | 267 | |
|
267 | 268 | self.execute('%%run %s' % path, hidden=hidden) |
|
268 | 269 |
General Comments 0
You need to be logged in to leave comments.
Login now