[IPython-dev] ipython1 remote exceptions causing local crashes
Douglas Jones
dfj225 at gmail.com
Wed Feb 21 09:44:22 EST 2007
Ah, it is good to hear that this is not a feature!
Sorry that my original message wasn't clear as to what was actually happening.
I've attached the crash report generated by IPython. In addition, I've
copied from my terminal some information that was printed out after
the "Mail this crash" message and doesn't seem to be in the auto
generated report.
First, some basic info about my machine:
Gentoo Linux 2.6.18 SMP
Python version: 2.4.3
Twisted version: 2.5.0 (I updated from 2.4.0 since my original
message, but the crash persists)
IPython version: 0.7.4.svn.r2010 (Crash was the same with earlier versions)
IPython1 "saw" branch: svn revision 2104
You can see the full list of commands that I've executed in the crash
report attached, but the basic overview is as follows:
rc.executeAll('a') # causes name exception, but does not crash the client
%autopx
a # same exception is generated here, but IPython
client crashes
If you need more information than what I've provided here, please let
me know and I will try to get whatever is needed.
Thanks,
~Doug
Here is what I've copied from the terminal after the IPython "mail
this crash" message.
Disconnecting from ('localhost', 10111)
Unhandled error in Deferred:
(debug: C: Deferred was created:
C: File "/usr/bin/ipython", line 27, in ?
C: IPython.Shell.start().mainloop()
C: File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line
59, in mainloop
C: self.IP.mainloop(banner)
C: File "/usr/lib64/python2.4/site-packages/IPython/iplib.py", line
1500, in mainloop
C: self.interact(banner)
C: File "/usr/lib64/python2.4/site-packages/IPython/iplib.py", line
1647, in interact
C: more = self.push(line)
C: File "/usr/lib64/python2.4/site-packages/IPython/iplib.py", line
1948, in push
C: more = self.runsource('\n'.join(self.buffer), self.filename)
C: File "/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/magic.py",
line 139, in pxrunsource
C: self.activeController.iexecuteAll(source)
C: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py",
line 294, in iexecuteAll
C: return self.iexecute('all', lines)
C: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py",
line 286, in iexecute
C: d = self.execute(targets, lines, block=False)
C: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py",
line 114, in execute
C: return self.multiengine.execute(targets, lines, block)
C: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multienginepb.py",
line 417, in execute
C: d2 = self._getActualDeferred(d)
C: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multienginepb.py",
line 398, in _getActualDeferred
C: d2 = self._getPendingDeferred(deferredID)
C: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multienginepb.py",
line 392, in _getPendingDeferred
C: d = self.callRemote('getPendingDeferred', deferredID)
C: File "/usr/lib64/python2.4/site-packages/twisted/spread/pb.py",
line 343, in callRemote
C: _name, args, kw)
C: File "/usr/lib64/python2.4/site-packages/twisted/spread/pb.py",
line 822, in _sendMessage
C: rval = defer.Deferred()
I: First Invoker was:
I: File "/usr/bin/ipython", line 27, in ?
I: IPython.Shell.start().mainloop()
I: File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line
59, in mainloop
I: self.IP.mainloop(banner)
I: File "/usr/lib64/python2.4/site-packages/IPython/iplib.py", line
1500, in mainloop
I: self.interact(banner)
I: File "/usr/lib64/python2.4/site-packages/IPython/iplib.py", line
1647, in interact
I: more = self.push(line)
I: File "/usr/lib64/python2.4/site-packages/IPython/iplib.py", line
1948, in push
I: more = self.runsource('\n'.join(self.buffer), self.filename)
I: File "/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/magic.py",
line 139, in pxrunsource
I: self.activeController.iexecuteAll(source)
I: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py",
line 294, in iexecuteAll
I: return self.iexecute('all', lines)
I: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py",
line 289, in iexecute
I: return self.blockOn(d)
I: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py",
line 87, in blockOn
I: return blockOn(d)
I: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/blockon.py",
line 156, in blockOn
I: return bd.blockOn()
I: File "/home/djones/local/ipython_saw//lib64/python2.4/site-packages/ipython1/kernel/blockon.py",
line 94, in blockOn
I: reactor.iterate(TIMEOUT)
I: File "/usr/lib64/python2.4/site-packages/twisted/internet/base.py",
line 382, in iterate
I: self.doIteration(delay)
I: File "/usr/lib64/python2.4/site-packages/twisted/internet/selectreactor.py",
line 133, in doSelect
I: _logrun(selectable, _drdw, selectable, method, dict)
I: File "/usr/lib64/python2.4/site-packages/twisted/python/log.py",
line 48, in callWithLogger
I: return callWithContext({"system": lp}, func, *args, **kw)
I: File "/usr/lib64/python2.4/site-packages/twisted/python/log.py",
line 33, in callWithContext
I: return context.call({ILogContext: newCtx}, func, *args, **kw)
I: File "/usr/lib64/python2.4/site-packages/twisted/python/context.py",
line 59, in callWithContext
I: return self.currentContext().callWithContext(ctx, func, *args, **kw)
I: File "/usr/lib64/python2.4/site-packages/twisted/python/context.py",
line 37, in callWithContext
I: return func(*args,**kw)
I: File "/usr/lib64/python2.4/site-packages/twisted/internet/selectreactor.py",
line 139, in _doReadOrWrite
I: why = getattr(selectable, method)()
I: File "/usr/lib64/python2.4/site-packages/twisted/internet/tcp.py",
line 362, in doRead
I: return self.protocol.dataReceived(data)
I: File "/usr/lib64/python2.4/site-packages/twisted/spread/banana.py",
line 218, in dataReceived
I: gotItem(item)
I: File "/usr/lib64/python2.4/site-packages/twisted/spread/banana.py",
line 148, in gotItem
I: self.callExpressionReceived(item)
I: File "/usr/lib64/python2.4/site-packages/twisted/spread/banana.py",
line 113, in callExpressionReceived
I: self.expressionReceived(obj)
I: File "/usr/lib64/python2.4/site-packages/twisted/spread/pb.py",
line 522, in expressionReceived
I: method(*sexp[1:])
I: File "/usr/lib64/python2.4/site-packages/twisted/spread/pb.py",
line 891, in proto_answer
I: d.callback(self.unserialize(netResult))
)
Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/twisted/spread/pb.py", line
847, in _recvMessage
netResult = object.remoteMessageReceived(self, message, netArgs, netKw)
File "/usr/lib64/python2.4/site-packages/twisted/spread/flavors.py",
line 119, in remoteMessageReceived
state = method(*args, **kw)
File "/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/enginepb.py",
line 288, in remote_execute
d = self.service.execute(lines)
File "/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/engineservice.py",
line 227, in execute
d = defer.execute(self.shell.execute, lines)
--- <exception caught here> ---
File "/usr/lib64/python2.4/site-packages/twisted/internet/defer.py",
line 79, in execute
result = callable(*args, **kw)
File "/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/core/shell.py",
line 209, in execute
raise self._tracebackTuple
exceptions.NameError:
On 2/20/07, Fernando Perez <fperez.net at gmail.com> wrote:
> Hi,
>
> On 2/20/07, Douglas Jones <dfj225 at gmail.com> wrote:
>
> > Please forgive me if some of the issues I bring up have already been
> > discussed or have already been addressed in the code, as I haven't
> > been able to look through all of the new features and changes.
> >
> > For the project that I am working on, it seems that one of the big
> > features is to use your cluster in an interactive manner. The "feel"
> > of this for our current implementation is much like typing any other
> > command into your python shell. Ipython1 goes a long way to providing
> > the features to make this necessary.
> >
> > That said, it seems like an overreaction to have the user, more or
> > less, ejected from their interactive session for what may have been a
> > trivial mistake. I think one of the nice features of working
> > interactively is that you are given a chance to fix the mistake and
> > continue along with minimal fuss.
>
> [...]
>
> Ah! What you are mentionig is most definitely a bug, though. Our
> current expectation is that when you get a remote exception, you
> should see an /exception/ in the local interactive shell, with a nice
> traceback and all that. But if you're actually getting dumped /out/
> of ipython with a 'mail this crash report' message, that is a bug,
> plain and simple.
>
> Please do send us that crash report and whatever other details you
> feel are relevant, and we'll try to hunt this one down ASAP.
>
> Our intent is that the remote-enabled usage should feel very close to
> the 'regular' ipython, so crashing out is definitely not a feature :)
>
> Sorry that I misunderstood your original message.
>
> Cheers,
>
> f
>
-------------- next part --------------
***************************************************************************
IPython post-mortem report
IPython version: 0.7.4.svn.r2010
SVN revision : 2010M
Platform info : os.name -> posix, sys.platform -> linux2
***************************************************************************
Current user configuration structure:
{'Version': 0,
'__allownew': False,
'alias': [],
'args': [],
'autocall': 1,
'autoedit_syntax': 0,
'autoindent': 1,
'automagic': 1,
'banner': 1,
'c': '',
'cache_size': 1000,
'classic': 0,
'color_info': 1,
'colors': 'Linux',
'confirm_exit': 1,
'debug': 0,
'deep_reload': 0,
'editor': '/usr/bin/vim',
'embedded': False,
'execfile': [],
'execute': [''],
'gthread': 0,
'help': 0,
'ignore': 0,
'import_all': [],
'import_mod': [],
'import_some': [[]],
'include': [],
'ipythondir': '/home/djones/.ipython',
'log': 0,
'logfile': '',
'logplay': '',
'magic_docstrings': 0,
'messages': 1,
'multi_line_specials': 1,
'nosep': 0,
'object_info_string_level': 0,
'opts': Struct({'__allownew': True}),
'pdb': 0,
'pprint': 1,
'profile': '',
'prompt_in1': 'In [\\#]: ',
'prompt_in2': ' .\\D.: ',
'prompt_out': 'Out[\\#]: ',
'prompts_pad_left': 1,
'pylab': 0,
'q4thread': 0,
'qthread': 0,
'quick': 0,
'quiet': 0,
'rcfile': 'ipythonrc',
'readline': 1,
'readline_merge_completions': 1,
'readline_omit__names': 0,
'readline_parse_and_bind': ['tab: complete',
'"\\C-l": possible-completions',
'set show-all-if-ambiguous on',
'"\\C-o": tab-insert',
'"\\M-i": " "',
'"\\M-o": "\\d\\d\\d\\d"',
'"\\M-I": "\\d\\d\\d\\d"',
'"\\C-r": reverse-search-history',
'"\\C-s": forward-search-history',
'"\\C-p": history-search-backward',
'"\\C-n": history-search-forward',
'"\\e[A": history-search-backward',
'"\\e[B": history-search-forward',
'"\\C-k": kill-line',
'"\\C-u": unix-line-discard'],
'readline_remove_delims': '-/~',
'screen_length': -2,
'separate_in': '\n',
'separate_out': '',
'separate_out2': '',
'system_header': 'IPython system call: ',
'system_verbose': 0,
'term_title': 1,
'tk': 0,
'upgrade': 0,
'wildcards_case_sensitive': 1,
'wthread': 0,
'wxversion': '0',
'xmode': 'Context'}
***************************************************************************
Crash traceback:
---------------------------------------------------------------------------
exceptions.NameError Python 2.4.3: /usr/bin/python
Wed Feb 21 09:26:41 2007
A problem occured executing Python code. Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/usr/bin/ipython
12 IPython.Shell.IPShell().mainloop(sys_exit=1)
13
14 [or simply IPython.Shell.IPShell().mainloop(1) ]
15
16 and IPython will be your working environment when you start python. The final
17 sys.exit() call will make python exit transparently when IPython finishes, so
18 you don't have an extra prompt to get out of.
19
20 This is probably useful to developers who manage multiple Python versions and
21 don't want to have correspondingly multiple IPython versions. Note that in
22 this mode, there is no way to pass IPython any command-line options, as those
23 are trapped first by Python itself.
24 """
25
26 import IPython
---> 27 IPython.Shell.start().mainloop()
IPython.Shell.start.mainloop = undefined
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/usr/lib64/python2.4/site-packages/IPython/Shell.py in mainloop(self=<IPython.Shell.IPShell instance>, sys_exit=0, banner=None)
44 #-----------------------------------------------------------------------------
45 # This class is trivial now, but I want to have it in to publish a clean
46 # interface. Later when the internals are reorganized, code that uses this
47 # shouldn't have to change.
48
49 class IPShell:
50 """Create an IPython instance."""
51
52 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
53 debug=1,shell_class=InteractiveShell):
54 self.IP = make_IPython(argv,user_ns=user_ns,
55 user_global_ns=user_global_ns,
56 debug=debug,shell_class=shell_class)
57
58 def mainloop(self,sys_exit=0,banner=None):
---> 59 self.IP.mainloop(banner)
self.IP.mainloop = <bound method InteractiveShell.mainloop of <IPython.iplib.InteractiveShell object at 0x2b0675e2f210>>
banner = None
60 if sys_exit:
61 sys.exit()
62
63 #-----------------------------------------------------------------------------
64 class IPShellEmbed:
65 """Allow embedding an IPython shell into a running program.
66
67 Instances of this class are callable, with the __call__ method being an
68 alias to the embed() method of an InteractiveShell instance.
69
70 Usage (see also the example-embed.py file for a running example):
71
72 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override])
73
74 - argv: list containing valid command-line options for IPython, as they
/usr/lib64/python2.4/site-packages/IPython/iplib.py in mainloop(self=<IPython.iplib.InteractiveShell object>, banner='Python 2.4.3 (#1, Oct 25 2006, 17:53:09) \nType "...ut \'object\'. ?object also works, ?? prints more.\n')
1485
1486 If an optional banner argument is given, it will override the
1487 internally created default banner."""
1488
1489 if self.rc.c: # Emulate Python's -c option
1490 self.exec_init_cmd()
1491 if banner is None:
1492 if not self.rc.banner:
1493 banner = ''
1494 # banner is string? Use it directly!
1495 elif isinstance(self.rc.banner,basestring):
1496 banner = self.rc.banner
1497 else:
1498 banner = self.BANNER+self.banner2
1499
-> 1500 self.interact(banner)
self.interact = <bound method InteractiveShell.interact of <IPython.iplib.InteractiveShell object at 0x2b0675e2f210>>
banner = 'Python 2.4.3 (#1, Oct 25 2006, 17:53:09) \nType "copyright", "credits" or "license" for more information.\n\nIPython 0.7.4.svn.r2010 -- An enhanced Interactive Python.\n? -> Introduction to IPython\'s features.\n%magic -> Information about IPython\'s \'magic\' % functions.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\'. ?object also works, ?? prints more.\n'
1501
1502 def exec_init_cmd(self):
1503 """Execute a command given at the command line.
1504
1505 This emulates Python's -c option."""
1506
1507 #sys.argv = ['-c']
1508 self.push(self.rc.c)
1509
1510 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1511 """Embeds IPython into a running python program.
1512
1513 Input:
1514
1515 - header: An optional header message can be specified.
/usr/lib64/python2.4/site-packages/IPython/iplib.py in interact(self=<IPython.iplib.InteractiveShell object>, banner='Python 2.4.3 (#1, Oct 25 2006, 17:53:09) \nType "...ut \'object\'. ?object also works, ?? prints more.\n')
1632 except EOFError:
1633 if self.autoindent:
1634 self.readline_startup_hook(None)
1635 self.write('\n')
1636 self.exit()
1637 except bdb.BdbQuit:
1638 warn('The Python debugger has exited with a BdbQuit exception.\n'
1639 'Because of how pdb handles the stack, it is impossible\n'
1640 'for IPython to properly format this particular exception.\n'
1641 'IPython will resume normal operation.')
1642 except:
1643 # exceptions here are VERY RARE, but they can be triggered
1644 # asynchronously by signal handlers, for example.
1645 self.showtraceback()
1646 else:
-> 1647 more = self.push(line)
more = False
self.push = <bound method InteractiveShell.push of <IPython.iplib.InteractiveShell object at 0x2b0675e2f210>>
line = 'a'
1648 if (self.SyntaxTB.last_syntax_error and
1649 self.rc.autoedit_syntax):
1650 self.edit_syntax_error()
1651
1652 # We are off again...
1653 __builtin__.__dict__['__IPYTHON__active'] -= 1
1654
1655 def excepthook(self, etype, value, tb):
1656 """One more defense for GUI apps that call sys.excepthook.
1657
1658 GUI frameworks like wxPython trap exceptions and call
1659 sys.excepthook themselves. I guess this is a feature that
1660 enables them to keep running after exceptions that would
1661 otherwise kill their mainloop. This is a bother for IPython
1662 which excepts to catch all of the program exceptions with a try:
/usr/lib64/python2.4/site-packages/IPython/iplib.py in push(self=<IPython.iplib.InteractiveShell object>, line='a')
1933 is reset; otherwise, the command is incomplete, and the buffer
1934 is left as it was after the line was appended. The return
1935 value is 1 if more input is required, 0 if the line was dealt
1936 with in some way (this is the same as runsource()).
1937 """
1938
1939 # autoindent management should be done here, and not in the
1940 # interactive loop, since that one is only seen by keyboard input. We
1941 # need this done correctly even for code run via runlines (which uses
1942 # push).
1943
1944 #print 'push line: <%s>' % line # dbg
1945 for subline in line.splitlines():
1946 self.autoindent_update(subline)
1947 self.buffer.append(line)
-> 1948 more = self.runsource('\n'.join(self.buffer), self.filename)
more = undefined
self.runsource.join = undefined
self.buffer = ['a']
self.filename = '<ipython console>'
1949 if not more:
1950 self.resetbuffer()
1951 return more
1952
1953 def resetbuffer(self):
1954 """Reset the input buffer."""
1955 self.buffer[:] = []
1956
1957 def raw_input(self,prompt='',continue_prompt=False):
1958 """Write a prompt and read a line.
1959
1960 The returned line does not include the trailing newline.
1961 When the user enters the EOF key sequence, EOFError is raised.
1962
1963 Optional inputs:
/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/magic.py in pxrunsource(self=<IPython.iplib.InteractiveShell object>, source='a', filename='<ipython console>', symbol='single')
124 # Case 1
125 self.showsyntaxerror(filename)
126 return None
127
128 if code is None:
129 # Case 2
130 return True
131
132 # Case 3
133 # Because autopx is enabled, we now call executeAll or disable autopx if
134 # %autopx or autopx has been called
135 if '_ip.magic("%autopx' in source or '_ip.magic("autopx' in source:
136 _disable_autopx(self)
137 return False
138 else:
--> 139 self.activeController.iexecuteAll(source)
self.activeController.iexecuteAll = <bound method PBInteractiveMultiEngineClient.iexecuteAll of <ipython1.kernel.multienginepb.PBInteractiveMultiEngineClient object at 0x2b067b832e10>>
source = 'a'
140 return False
141
142 def magic_autopx(self, parameter_s=''):
143 """Toggles auto parallel mode for the active IPython Controller.
144
145 To activate a Controller in IPython, first create it and then call
146 the activate() method.
147
148 Then you can do the following:
149
150 >>> %autopx # Now all commands are executed in parallel
151 Auto Parallel Enabled
152 Type %autopx to disable
153 ...
154 >>> %autopx # Now all commands are locally executed
/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py in iexecuteAll(self=<ipython1.kernel.multienginepb.PBInteractiveMultiEngineClient object>, lines='a')
279 if cmd_stderr:
280 print "%s[%s:%i]%s Err[%i]:\n%s %s" % \
281 (green, self.addr[0], target,
282 red, cmd_num, normal, cmd_stderr)
283 return None
284
285 def iexecute(self, targets, lines, block=None):
286 d = self.execute(targets, lines, block=False)
287 d.addCallback(self._printResult)
288 if (self.block and block is None) or block:
289 return self.blockOn(d)
290 else:
291 return d
292
293 def iexecuteAll(self, lines):
--> 294 return self.iexecute('all', lines)
self.iexecute = <bound method PBInteractiveMultiEngineClient.iexecute of <ipython1.kernel.multienginepb.PBInteractiveMultiEngineClient object at 0x2b067b832e10>>
lines = 'a'
295
296 def igetResult(self, targets, i=None):
297 saveBlock = self.block
298 self.block = False
299 d = self.getResult(targets, i)
300 d.addCallback(self._printResult)
301 self.block = saveBlock
302 return self._blockOrNot(d)
303
304 def igetResultAll(self, i=None):
305 return self.igetResult('all', i)
306
307 def _printQueueStatus(self, status):
308 for e in status:
309 print "Engine: ", e[0]
/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py in iexecute(self=<ipython1.kernel.multienginepb.PBInteractiveMultiEngineClient object>, targets='all', lines='a', block=None)
274 blue, cmd_num, normal, cmd_stdin)
275 if cmd_stdout:
276 print "%s[%s:%i]%s Out[%i]:%s %s" % \
277 (green, self.addr[0], target,
278 red, cmd_num, normal, cmd_stdout)
279 if cmd_stderr:
280 print "%s[%s:%i]%s Err[%i]:\n%s %s" % \
281 (green, self.addr[0], target,
282 red, cmd_num, normal, cmd_stderr)
283 return None
284
285 def iexecute(self, targets, lines, block=None):
286 d = self.execute(targets, lines, block=False)
287 d.addCallback(self._printResult)
288 if (self.block and block is None) or block:
--> 289 return self.blockOn(d)
self.blockOn = <bound method PBInteractiveMultiEngineClient.blockOn of <ipython1.kernel.multienginepb.PBInteractiveMultiEngineClient object at 0x2b067b832e10>>
d = <Deferred at 0x2b067b6f93b0 current result: <twisted.python.failure.Failure exceptions.NameError>>
290 else:
291 return d
292
293 def iexecuteAll(self, lines):
294 return self.iexecute('all', lines)
295
296 def igetResult(self, targets, i=None):
297 saveBlock = self.block
298 self.block = False
299 d = self.getResult(targets, i)
300 d.addCallback(self._printResult)
301 self.block = saveBlock
302 return self._blockOrNot(d)
303
304 def igetResultAll(self, i=None):
/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/multiengineclient.py in blockOn(self=<ipython1.kernel.multienginepb.PBInteractiveMultiEngineClient object>, d=<Deferred at 0x2b067b6f93b0 current result: <twisted.python.failure.Failure exceptions.NameError>>)
72
73 def _setBlock(self, block):
74 self._block = block
75 if self.multiengine is not None:
76 self.multiengine.block = block
77
78 block = property(_getBlock, _setBlock, None, None)
79
80 def __init__(self, addr):
81 self.addr = addr
82 self.multiengine = None
83 self._block = True
84 self.connected = False
85
86 def blockOn(self, d):
---> 87 return blockOn(d)
global blockOn = <function blockOn at 0x2b067b46d758>
d = <Deferred at 0x2b067b6f93b0 current result: <twisted.python.failure.Failure exceptions.NameError>>
88
89 def _blockOrNot(self, d):
90 if self._block:
91 return self.blockOn(d)
92 else:
93 return d
94
95 #---------------------------------------------------------------------------
96 # Methods for subclasses to override
97 #---------------------------------------------------------------------------
98
99 def connect(self):
100 """Create self.multiengine and set self.connected to True.
101
102 Implementers of this method must also (after creating self.multiengine)
/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/blockon.py in blockOn(deferrable=[<Deferred at 0x2b067b6f93b0 current result: <twisted.python.failure.Failure exceptions.NameError>>], fireOnOneCallback=0, fireOnOneErrback=0, consumeErrors=0)
141 deferrable = [deferrable]
142
143 # Add a check to simply pass through plain objects.
144 for i in range(len(deferrable)):
145 if hasattr(deferrable[i], '__defer__'):
146 deferrable[i] = deferrable[i].__defer__()
147
148 d = gatherBoth(deferrable,
149 fireOnOneCallback,
150 fireOnOneErrback,
151 consumeErrors,
152 logErrors=0)
153 if not fireOnOneCallback:
154 d.addCallback(_parseResults)
155 bd = BlockingDeferred(d)
--> 156 return bd.blockOn()
bd.blockOn = <bound method BlockingDeferred.blockOn of <ipython1.kernel.blockon.BlockingDeferred object at 0x2b067b90b410>>
157
158
159 # Start the reactor
160 startReactor()
161
162
163
164
165
166
167
168
169
170
171
/home/djones/local/ipython_saw/lib64/python2.4/site-packages/ipython1/kernel/blockon.py in blockOn(self=<ipython1.kernel.blockon.BlockingDeferred object>)
85 On success this will return the result.
86
87 On failure, it will raise an exception.
88 """
89
90 self.d.addBoth(self.gotResult)
91 self.d.addErrback(self.gotFailure)
92
93 while not self.finished:
94 reactor.iterate(TIMEOUT)
95 self.count += 1
96
97 if isinstance(self.d.result, dict):
98 f = self.d.result.get('failure', None)
99 if isinstance(f, failure.Failure):
--> 100 f.raiseException()
f.raiseException = <bound method Failure.raiseException of <twisted.python.failure.Failure exceptions.NameError>>
101 return self.d.result
102
103 def gotResult(self, result):
104 self.finished = True
105 return result
106
107 def gotFailure(self, f):
108 self.finished = True
109 # Now make it look like a success so the failure isn't unhandled
110 return {'failure':f}
111
112
113 def _parseResults(result):
114 if isinstance(result, (list, tuple)):
115 if len(result) == 1:
/usr/lib64/python2.4/site-packages/twisted/python/failure.py in raiseException(self=<twisted.python.failure.Failure exceptions.NameError>)
244 @returns: the matching L{Exception} type, or None if no match.
245 """
246 for error in errorTypes:
247 err = error
248 if inspect.isclass(error) and issubclass(error, Exception):
249 err = reflect.qual(error)
250 if err in self.parents:
251 return error
252 return None
253
254 def raiseException(self):
255 """
256 raise the original exception, preserving traceback
257 information if available.
258 """
--> 259 raise self.type, self.value, self.tb
self.type = <class exceptions.NameError at 0x2b0675de65f0>
self.value = <exceptions.NameError instance at 0x2b067b6f8518>
self.tb = None
260
261
262 def __repr__(self):
263 return "<%s %s>" % (self.__class__, self.type)
264
265 def __str__(self):
266 return "[Failure instance: %s]" % self.getBriefTraceback()
267
268 def __getstate__(self):
269 """Avoid pickling objects in the traceback.
270 """
271 if self.pickled:
272 return self.__dict__
273 c = self.__dict__.copy()
274
NameError:
***************************************************************************
History of session input:
import ipython1.kernel.api as api
rc = api.RemoteController(('localhost',10111))
rc.connect()
rc.activate()
rc.executeAll("a")
_ip.magic("%autopx ")
a
*** Last line of input (may not be in above history):
a
More information about the IPython-dev
mailing list