Here the parse_options method is where the paths get messed up. If
the path has spaces, parse_options is splitting on the spaces and only
returning the first part of the path. If the path has the "~" chars,
it somehow deletes the ""\\"" path separators. I don't have time to
fix this now, but that is what is wrong.
I have added a new function to platutils that can expand the "~" in
Windows paths:
In [1]: import tempfile
In [2]: import os
In [3]: from IPython.platutils import get_long_path_name
In [4]: f = tempfile. NamedTemporaryF ile(suffix= '.py')
In [5]: f.write('pass\n')
In [6]: name = f.name
In [7]: bname = get_long_ path_name( name)
In [10]: name 1\\admini~ 1\\locals~ 1\\temp\ \tmpixcmwt. py'
Out[10]: 'c:\\docume~
In [11]: bname \Administrator\ \Local \Temp\\ tmpixcmwt. py'
Out[11]: u'c:\\Documents and Settings\
Settings\
In [8]: %run $name 1admini~ 1locals~ 1temptmpixcmwt. py` not found.
ERROR: File `c:docume~
In [9]: %run $bname
ERROR: File `c:Documents.py` not found.
Run chokes on both forms of Windows paths. I have tracked the problem
down to line 1557 of Magic.py:
Here the parse_options method is where the paths get messed up. If
the path has spaces, parse_options is splitting on the spaces and only
returning the first part of the path. If the path has the "~" chars,
it somehow deletes the ""\\"" path separators. I don't have time to
fix this now, but that is what is wrong.