[IPython-dev] octavemagic failed
Stephan Sahm
Stephan.Sahm at gmx.de
Tue Sep 9 14:14:21 EDT 2014
Dear Thomas,
thanks a lot for the fast response. The magic does not throw the errors
mentioned, instead it simply hangs.
I the same behaviour was already registered as a bug however in another
setting (see
http://stackoverflow.com/questions/24999313/octave-hangs-in-ipython)
I browsed some minutes, but could not find a mailinglist or github bug
report possibility for octpy. I am not shure how to proceed: Shall I answer
on the above stackoverflow? recreating the topic, is something like that
possible?
Meanwhile I also tried the oct2py version 1.6 (instead of 2.1) specified at
the solution from the above link. It is quite slow, but everything works as
expected. So it really seems to be a bug in oct2py 2.1 which probably
should be forwarded to the right persons.
Thanks,
Stephan
On 9 September 2014 19:44, Thomas Kluyver <takowl at gmail.com> wrote:
> Hi Stephan,
>
> Octavemagic is now part of Oct2py - try loading the extension as %load_ext
> oct2py.ipython to get the latest version. If you still see the error, file
> a bug with oct2py.
>
> Thanks,
> Thomas
>
> On 9 September 2014 10:32, Stephan Sahm <Stephan.Sahm at gmx.de> wrote:
>
>> 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
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140909/5cddd315/attachment.html>
More information about the IPython-dev
mailing list