Comment 3 for bug 366353

Revision history for this message
Brian Granger (ellisonbg) wrote : Re: [Bug 366353] Re: %run doesn't work with paths returned by tempfile.NamedTemporaryFile()

I see paths that have the ~ in them (used to shorten the path). I
don't know how to fix this and I need to keep moving to get this out.

Brian

On Fri, Apr 24, 2009 at 3:42 PM, Fernando Perez <email address hidden> wrote:
> Brian, I don't see this bug:
>
> In [5]: import tempfile
>
> In [6]: f = tempfile.NamedTemporaryFile()
>
> In [7]: f.write('print 999\n')
>
> In [8]: f.flush()
>
> In [9]: %run $f.name
> 999
>
>
> This works fine for me on linux.  Is it an issue with spaces in the paths you're seeing instead?  It's possible that the problem is that %run doesn't handle paths with spaces in them...
>
> --
> %run doesn't work with paths returned by tempfile.NamedTemporaryFile()
> https://bugs.launchpad.net/bugs/366353
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: New
>
> Bug description:
> In test_magic we use tempfile.NamedTemporaryFile() to create files that are used with %run during the test suite.  The paths created by tempfile don't play well with %run:
>
> To reproduce, do:
>
> import tempfile
> f = tempfile.NamedTemporaryFile()
> f.write('pass\n')
> %run $f.name
>

--
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
<email address hidden>
<email address hidden>