test_magic.test_obj_del fails on win32

Bug #366334 reported by Brian Granger
2
Affects Status Importance Assigned to Milestone
IPython
Confirmed
High
Unassigned

Bug Description

test_obj_del fails on win32 because getoutput is called like this:

IP.getoutput('ipython obj_del.py')

But on Windows, the ipython executable is not found. This causes stdout to be empty
and stderr to have an error saying that ipython can't be found.

======================================================================
FAIL: Test that object's __del__ methods are called on exit.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\python24\lib\site-packages\nose-0.10.4-py2.4.egg\nose\case.py", line 182, in runTest
    self.test(*self.arg)
  File "c:\python24\external\ipython\IPython\tests\test_magic.py", line 86, in test_obj_del
    nt.assert_equals(out,'obj_del.py: object A deleted')
AssertionError: '' != 'obj_del.py: object A deleted'
>> raise self.failureException, \
          (None or '%r != %r' % ('', 'obj_del.py: object A deleted'))

----------------------------------------------------------------------

Changed in ipython:
importance: Undecided → High
milestone: none → 0.11
status: New → Confirmed
Revision history for this message
Brian Granger (ellisonbg) wrote :

We are now finding ipython using platutils.find_cmd, but we still see this error.

Revision history for this message
Brian Granger (ellisonbg) wrote :

Here is an IPython session showing this bug:

In [4]: from IPython.platutils import find_cmd

In [5]: from IPython.platutils import get_long_path_name

In [6]: cmd = find_cmd('ipython')

In [7]: cmd
Out[7]: 'C:\\Python25\\Scripts\\ipython.exe'

In [8]: _ip.IP.getout
_ip.IP.getoutput _ip.IP.getoutputerror

In [8]: _ip.IP.getoutput(cmd+' obj_del.py')
Out[8]: ''

In [9]: _ip.IP.getoutput('ipython obj_del.py')
Out[9]: ''

I spent some time looking around and getoutput uses genutils.getoutput, which uses os.popen. The odd thing is when I use os.popen3, to get the stderr, it hangs and when I use CTRL-C to abort, IPython crashes hard. :-(

Revision history for this message
Jörgen Stenarson (jorgen-stenarson) wrote : Re: [Bug 366334] Re: test_magic.test_obj_del fails on win32

Brian Granger skrev:
> Here is an IPython session showing this bug:
>
> In [4]: from IPython.platutils import find_cmd
>
> In [5]: from IPython.platutils import get_long_path_name
>
> In [6]: cmd = find_cmd('ipython')
>
> In [7]: cmd
> Out[7]: 'C:\\Python25\\Scripts\\ipython.exe'
This exe file is some easy_install magic which has caused me some
problems before. Why not try to do a call to python ipython.py instead?

>
> In [8]: _ip.IP.getout
> _ip.IP.getoutput _ip.IP.getoutputerror
>
> In [8]: _ip.IP.getoutput(cmd+' obj_del.py')
> Out[8]: ''
>
> In [9]: _ip.IP.getoutput('ipython obj_del.py')
> Out[9]: ''
>
> I spent some time looking around and getoutput uses genutils.getoutput,
> which uses os.popen. The odd thing is when I use os.popen3, to get the
> stderr, it hangs and when I use CTRL-C to abort, IPython crashes hard.
> :-(
This crash may be related to the problem I have seen with ipython.exe
before. There have been some threads on the lists about this problem
before. Basically the ipython.exe launches a new process that starts a
python process that runs ipython. But the original process still sees
any ctrl-c action you do and shuts down. My recomendation is to not use
ipython.exe at all.

/Jörgen

Revision history for this message
Brian Granger (ellisonbg) wrote :

Ahh, that may be it. I will give this a shot.

Brian

On Sun, Apr 26, 2009 at 1:10 AM, Jörgen Stenarson
<email address hidden> wrote:
> Brian Granger skrev:
>> Here is an IPython session showing this bug:
>>
>> In [4]: from IPython.platutils import find_cmd
>>
>> In [5]: from IPython.platutils import get_long_path_name
>>
>> In [6]: cmd = find_cmd('ipython')
>>
>> In [7]: cmd
>> Out[7]: 'C:\\Python25\\Scripts\\ipython.exe'
> This exe file is some easy_install magic which has caused me some
> problems before. Why not try to do a call to python ipython.py instead?
>
>>
>> In [8]: _ip.IP.getout
>> _ip.IP.getoutput      _ip.IP.getoutputerror
>>
>> In [8]: _ip.IP.getoutput(cmd+' obj_del.py')
>> Out[8]: ''
>>
>> In [9]: _ip.IP.getoutput('ipython obj_del.py')
>> Out[9]: ''
>>
>> I spent some time looking around and getoutput uses genutils.getoutput,
>> which uses os.popen.  The odd thing is when I use os.popen3, to get the
>> stderr, it hangs and when I use CTRL-C to abort, IPython crashes hard.
>> :-(
> This crash may be related to the problem I have seen with ipython.exe
> before. There have been some threads on the lists about this problem
> before. Basically the ipython.exe launches a new process that starts a
> python process that runs ipython. But the original process still sees
> any ctrl-c action you do and shuts down. My recomendation is to not use
> ipython.exe at all.
>
> /Jörgen
>
> --
> test_magic.test_obj_del fails on win32
> https://bugs.launchpad.net/bugs/366334
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: Confirmed
>
> Bug description:
> test_obj_del fails on win32 because getoutput is called like this:
>
> IP.getoutput('ipython obj_del.py')
>
> But on Windows, the ipython executable is not found.  This causes stdout to be empty
> and stderr to have an error saying that ipython can't be found.
>
> ======================================================================
> FAIL: Test that object's __del__ methods are called on exit.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "c:\python24\lib\site-packages\nose-0.10.4-py2.4.egg\nose\case.py", line 182, in runTest
>    self.test(*self.arg)
>  File "c:\python24\external\ipython\IPython\tests\test_magic.py", line 86, in test_obj_del
>    nt.assert_equals(out,'obj_del.py: object A deleted')
> AssertionError: '' != 'obj_del.py: object A deleted'
>>> raise self.failureException, \
>          (None or '%r != %r' % ('', 'obj_del.py: object A deleted'))
>
> ----------------------------------------------------------------------
>

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.