Show More
@@ -253,6 +253,18 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 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: | |||
|
262 | raise ValueError("Can't run filename containing both single " | |||
|
263 | "and double quotes: %s" % path) | |||
|
264 | path = "'%s'" % path | |||
|
265 | elif ' ' in path or "'" in path: | |||
|
266 | path = '"%s"' % path | |||
|
267 | ||||
256 | self.execute('%%run %s' % path, hidden=hidden) |
|
268 | self.execute('%%run %s' % path, hidden=hidden) | |
257 |
|
269 | |||
258 | #--------------------------------------------------------------------------- |
|
270 | #--------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now