[IPython-dev] octavemagic failed

Stephan Sahm Stephan.Sahm at gmx.de
Tue Sep 9 13:32:49 EDT 2014


Dear all,

I use ipython for some years up to now but today it was the first time I
tried the octavemagic -- and unfortunately almost everything failed.
(copied from my ipython notebook session:)

%load_ext octavemagic  # works

import oct2py
o = oct2py.Oct2Py()
x = o.eval('[1; 2; 3]')
print x

# works too, output= [[ 1.]
 [ 2.]
 [ 3.]]

# but...


x = %octave [1 2; 3 4];  # fails

​
The ErrorMessage is the following:

IndexError                                Traceback (most recent call
last)<ipython-input-7-37126fd10549> in <module>()----> 1 x =
get_ipython().magic(u'octave [1 2; 3 4];')
/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc
in magic(self, arg_s)   2203         magic_name, _, magic_arg_s =
arg_s.partition(' ')   2204         magic_name =
magic_name.lstrip(prefilter.ESC_MAGIC)-> 2205         return
self.run_line_magic(magic_name, magic_arg_s)   2206    2207
#-------------------------------------------------------------------------
/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc
in run_line_magic(self, magic_name, line)   2124
kwargs['local_ns'] = sys._getframe(stack_depth).f_locals   2125
     with self.builtin_trap:-> 2126                 result =
fn(*args,**kwargs)   2127             return result   2128
/usr/local/lib/python2.7/dist-packages/IPython/extensions/octavemagic.pyc
in octave(self, line, cell, local_ns)
/usr/local/lib/python2.7/dist-packages/IPython/core/magic.pyc in
<lambda>(f, *a, **k)    191     # but it's overkill for just that one
bit of state.    192     def magic_deco(arg):--> 193         call =
lambda f, *a, **k: f(*a, **k)    194     195         if callable(arg):
/usr/local/lib/python2.7/dist-packages/IPython/extensions/octavemagic.pyc
in octave(self, line, cell, local_ns)    327         except
(oct2py.Oct2PyError) as exception:    328             msg =
exception.message--> 329             msg = msg.split('#
___<end_pre_call>___ #')[1]    330             msg = msg.split('#
___<start_post_call>___ #')[0]    331             raise
OctaveMagicError('Octave could not complete execution.  '


IndexError: list index out of range

​​
​​
​using the cell-octave-magic ​

%%octave -s 600,200 -f png
sombrero()


the following related ErrorMessage is thrown:

IndexError                                Traceback (most recent call
last)<ipython-input-9-68806585bb19> in <module>()----> 1
get_ipython().run_cell_magic(u'octave', u'-s 600,200 -f png',
u'sombrero()')
/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc
in run_cell_magic(self, magic_name, line, cell)   2160
magic_arg_s = self.var_expand(line, stack_depth)   2161
with self.builtin_trap:-> 2162                 result =
fn(magic_arg_s, cell)   2163             return result   2164
/usr/local/lib/python2.7/dist-packages/IPython/extensions/octavemagic.pyc
in octave(self, line, cell, local_ns)
/usr/local/lib/python2.7/dist-packages/IPython/core/magic.pyc in
<lambda>(f, *a, **k)    191     # but it's overkill for just that one
bit of state.    192     def magic_deco(arg):--> 193         call =
lambda f, *a, **k: f(*a, **k)    194     195         if callable(arg):
/usr/local/lib/python2.7/dist-packages/IPython/extensions/octavemagic.pyc
in octave(self, line, cell, local_ns)    327         except
(oct2py.Oct2PyError) as exception:    328             msg =
exception.message--> 329             msg = msg.split('#
___<end_pre_call>___ #')[1]    330             msg = msg.split('#
___<start_post_call>___ #')[0]    331             raise
OctaveMagicError('Octave could not complete execution.  '
IndexError: list index out of range



​I have the following version installed

oct2py : 2.1​
ipython : 2.2
octave : 3.8.1-1ubuntu1

​
I use Ubuntu 14.04 and installed octave via apt-get, oct2py and ipython via
pip​

Can anyone help me?
Of course I would be glad if this is only a small failure and can be fixed
soon

Hoping for your help,

Stephan
​​
​​
​​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140909/f2f64ccf/attachment.html>


More information about the IPython-dev mailing list