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