[IPython-user] [Pytables-users] Failing tests with 2.0rc1
Mon Aug 13 12:55:25 CDT 2007
A Monday 13 August 2007, Fernando Perez escrigué:
> On 8/13/07, Francesc Altet <email@example.com> wrote:
> > I've checked that test_all.py returns a value of 0 when it exits (i.e. $?
> > variable has a 0 value, as it should). Perhaps IPython is (wrongly)
> > assuming that returning a 0 is a failure instead of success?
> There's a difference between the system exit status of a child process
> ($?) being zero and the fact that an exception was raised *inside* a
> Python process, which sys.exit() unconditionally does. In fact, if
> you were to run that code in a normal python shell, you'd just get
> dumped out to the prompt:
> maqroll[~]> cat foo.py
> import sys
> maqroll[~]> python
> Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> execfile('foo.py')
> maqroll[~]> # oops, out of the interpeter!
> IPython has a special trap on SystemExit to precisely prevent this
> from happening.
> What you want to use when running code that raises SystemExit is the
> special '-e' flag to %run, which makes %run ignore the SystemExit
> exception altogether:
> In : run foo
> SystemExit Traceback (most recent call last)
> /home/fperez/foo.py in <module>()
> ----> 2 import sys
> 3 sys.exit(0)
> SystemExit: 0
> WARNING: Failure executing file: <foo.py>
> In : run -e foo
> I introduced that flag precisely for the purpose of running unittests
> inside ipython.
> I guess I could modify the SystemExit trap to check for 0 as a value
> and simply print a short message in that case... For code that uses
> sys.exit() correctly to signal exit status, this would be nicer. OK,
> I think I'll do that.
Ok. I'll let the expert pondering about the best thing to do.
> > And another small thing (the last one for today, I promise ;). I've
> > installed IPython from the nightly built eggs that you are providing
> > recently (very good job! BTW, how are you generating the Windows binary
> > automatically? I'd like to do the same with PyTables), and a couple of
> > errors appear during the installation:
> python setup.py bdist_wininst
> However, note that this only works if your program has *zero*
> extension code, since there's no cross-compilation going on at all.
> For ipython that's OK, but it won't work for pytables, which requires
> extension code to be compiled. What they did was to literally bundle
> the entire .exe as a inside of distutils:
> maqroll[command]> pwd
> maqroll[command]> ls *.exe
> wininst-6.exe wininst-7.1.exe
Oh, ok. Thanks for the information. It is useful to know that one can create
binaries on Linux even that this only works in the case that you don't have
> > Thanks again for delivering, improving and maintaining such a poweful
> > interpreter!
> My pleasure :) And thanks for pytables, which recently has proven
> great for a project at work!
That's good to hear!
>0,0< Francesc Altet http://www.carabos.com/
V V Cárabos Coop. V. Enjoy Data
More information about the IPython-user