Skip to content

Instantly share code, notes, and snippets.

@jstenar
Created June 28, 2011 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstenar/1051868 to your computer and use it in GitHub Desktop.
Save jstenar/1051868 to your computer and use it in GitHub Desktop.
crashreport for ipython issue "RuntimeError in completer"
***************************************************************************
IPython post-mortem report
{'commit_hash': 'f0437d2',
'commit_source': 'repository',
'ipython_path': 'c:\\python\\external\\ipython\\IPython',
'ipython_version': '0.11.dev',
'os_name': 'nt',
'platform': 'Windows-7-6.1.7601-SP1',
'sys_executable': 'c:\\python26\\python.exe',
'sys_platform': 'win32',
'sys_version': '2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]'}
***************************************************************************
Application name: ipython
Current user configuration structure:
{'ProfileDir': {}}
***************************************************************************
Crash traceback:
---------------------------------------------------------------------------
AttributeError Python 2.6.6: c:\python26\python.exe
Tue Jun 28 20:45:29 2011
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.
c:\python\external\ipython\IPython\core\completer.pyc in complete(self=<IPython.core.completer.IPCompleter object>, text='jokes.', line_buffer=u'jokes.', cursor_pos=6)
776
777 # Start with a clean slate of completions
778 self.matches[:] = []
779 custom_res = self.dispatch_custom_completer(text)
780 if custom_res is not None:
781 # did custom completers produce something?
782 self.matches = custom_res
783 else:
784 # Extend the list of completions with the results of each
785 # matcher, so we return results to the user from all
786 # namespaces.
787 if self.merge_completions:
788 self.matches = []
789 for matcher in self.matchers:
790 try:
--> 791 self.matches.extend(matcher(text))
792 except:
793 # Show the ugly traceback if the matcher causes an
794 # exception, but do NOT crash the kernel!
795 sys.excepthook(*sys.exc_info())
796 else:
797 for matcher in self.matchers:
798 self.matches = matcher(text)
799 if self.matches:
800 break
801 # FIXME: we should extend our api to return a dict with completions for
802 # different types of objects. The rlcomplete() method could then
803 # simply collapse the dict into a list for readline, but we'd have
804 # richer completion semantics in other evironments.
805 self.matches = sorted(set(self.matches))
806 #io.rprint('COMP TEXT, MATCHES: %r, %r' % (text, self.matches)) # dbg
c:\python\external\ipython\IPython\core\completer.pyc in python_matches(self=<IPython.core.completer.IPCompleter object>, text='jokes.')
570 if ' ' in main_text and not main_text.startswith('sudo'):
571 return []
572 text = os.path.expanduser(text)
573 aliases = self.alias_table.keys()
574 if text == '':
575 return aliases
576 else:
577 return [a for a in aliases if a.startswith(text)]
578
579 def python_matches(self,text):
580 """Match attributes or global python names"""
581
582 #print 'Completer->python_matches, txt=%r' % text # dbg
583 if "." in text:
584 try:
--> 585 matches = self.attr_matches(text)
586 if text.endswith('.') and self.omit__names:
587 if self.omit__names == 1:
588 # true if txt is _not_ a __ name, false otherwise:
589 no__name = (lambda txt:
590 re.match(r'.*\.__.*?__',txt) is None)
591 else:
592 # true if txt is _not_ a _ name, false otherwise:
593 no__name = (lambda txt:
594 re.match(r'.*\._.*?',txt) is None)
595 matches = filter(no__name, matches)
596 except NameError:
597 # catches <undefined attributes>.<tab>
598 matches = []
599 else:
600 matches = self.global_matches(text)
c:\python\external\ipython\IPython\core\completer.pyc in attr_matches(self=<IPython.core.completer.IPCompleter object>, text='jokes.')
353 # Another option, seems to work great. Catches things like ''.<tab>
354 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
355
356 if not m:
357 return []
358
359 expr, attr = m.group(1, 3)
360 try:
361 obj = eval(expr, self.namespace)
362 except:
363 try:
364 obj = eval(expr, self.global_namespace)
365 except:
366 return []
367
--> 368 words = dir2(obj)
text = 'jokes.'
global string = undefined
369
370 try:
371 words = generics.complete_object(obj, words)
372 except TryNext:
373 pass
374 # Build match list to return
375 n = len(attr)
376 res = ["%s.%s" % (expr, w) for w in words if w[:n] == attr ]
377 return res
378
379
380 class IPCompleter(Completer):
381 """Extension of the completer class with IPython-specific features"""
382
383 def __init__(self, shell, namespace=None, global_namespace=None,
c:\python\external\ipython\IPython\utils\dir2.pyc in dir2(obj=<DynamicProxy for PYRO://127.0.0.1:7766/c0a80a3e16907bf3f7d1009a6186ca3c>)
42 # with a few extra special-purpose calls.
43 words = dir(obj)
44
45 if hasattr(obj,'__class__'):
46 words.append('__class__')
47 words.extend(get_class_members(obj.__class__))
48 #if '__base__' in words: 1/0
49
50 # Some libraries (such as traits) may introduce duplicates, we want to
51 # track and clean this up if it happens
52 may_have_dupes = False
53
54 # this is the 'dir' function for objects with Enthought's traits
55 if hasattr(obj, 'trait_names'):
56 try:
---> 57 words.extend(obj.trait_names())
58 may_have_dupes = True
59 except TypeError:
60 # This will happen if `obj` is a class and not an instance.
61 pass
62
63 # Support for PyCrust-style _getAttributeNames magic method.
64 if hasattr(obj, '_getAttributeNames'):
65 try:
66 words.extend(obj._getAttributeNames())
67 may_have_dupes = True
68 except TypeError:
69 # `obj` is a class and not an instance. Ignore
70 # this error.
71 pass
72
c:\python26\lib\site-packages\pyro-3.14-py2.6.egg\Pyro\core.pyc in __call__(self=<Pyro.core._RemoteMethod object>, *args=(), **kwargs={})
366
367 def getProxyForURI(URI):
368 return DynamicProxy(URI)
369 def getAttrProxyForURI(URI):
370 return DynamicProxyWithAttrs(URI)
371
372 class _RemoteMethod(object):
373 # method call abstraction, adapted from Python's xmlrpclib
374 # it would be rather easy to add nested method calls, but
375 # that is not compatible with the way that Pyro's method
376 # calls are defined to work ( no nested calls )
377 def __init__(self, send, name):
378 self.__send = send
379 self.__name = name
380 def __call__(self, *args, **kwargs):
--> 381 return self.__send(self.__name, args, kwargs)
382
383 class DynamicProxy(object):
384 def __init__(self, URI):
385 _checkInit() # init required
386 if type(URI) in (StringType,UnicodeType):
387 URI=processStringURI(URI)
388 self.URI = URI
389 self.objectID = URI.objectID
390 # Delay adapter binding to enable transporting of proxies.
391 # We just create an adapter, and don't connect it...
392 self.adapter = Pyro.protocol.getProtocolAdapter(self.URI.protocol)
393 # ---- don't forget to register local vars with DynamicProxyWithAttrs, see below
394 def __del__(self):
395 try:
396 self.adapter.release(nolog=1)
c:\python26\lib\site-packages\pyro-3.14-py2.6.egg\Pyro\core.pyc in _invokePYRO(self=<DynamicProxy for PYRO://127.0.0.1:7766/c0a80a3e16907bf3f7d1009a6186ca3c>, name='trait_names', vargs=(), kargs={})
441 def __ne__(self,other):
442 # makes it possible to compare two proxies using objectID
443 return not hasattr(other,"objectID") or self.objectID!=other.objectID
444 def __nonzero__(self):
445 return 1
446 def __coerce__(self,other):
447 # makes it possible to compare two proxies using objectID (cmp)
448 if hasattr(other,"objectID"):
449 return (self.objectID, other.objectID)
450 return None
451
452 def _invokePYRO(self, name, vargs, kargs):
453 if not self.adapter.connected():
454 # rebind here, don't do it from inside the remoteInvocation because deadlock will occur
455 self.adapter.bindToURI(self.URI)
--> 456 return self.adapter.remoteInvocation(name, Pyro.constants.RIF_VarargsAndKeywords, vargs, kargs)
457
458 # Pickling support, otherwise pickle uses __getattr__:
459 def __getstate__(self):
460 # for pickling, return a non-connected copy of ourselves:
461 cpy = self.__copy__()
462 cpy._release()
463 return cpy.__dict__
464 def __setstate__(self, args):
465 # for pickling, to restore the pickled state
466 self.__dict__.update(args)
467
468
469 class DynamicProxyWithAttrs(DynamicProxy):
470 _local_attrs = ("_local_attrs","URI", "objectID", "adapter", "_attr_cache")
471 def __init__(self, URI):
c:\python26\lib\site-packages\pyro-3.14-py2.6.egg\Pyro\protocol.pyc in remoteInvocation(self=<Pyro.protocol.PYROAdapter object>, method='trait_names', flags=3, *args=((), {}))
442 answer=pickle.loads(answer)
443 if isinstance(answer,PyroExceptionCapsule):
444 if isinstance(answer.excObj,_InternalNoModuleError):
445 # server couldn't load module, supply it
446 return self.processMissingModuleError(answer.excObj, method, flags, args)
447 else:
448 # we have an encapsulated exception, raise it again.
449 answer.raiseEx()
450 return answer
451
452 def remoteInvocation(self, method, flags, *args):
453 with self.lock:
454 # only 1 thread at a time may use this connection to call a remote method
455 try:
456 self.__pyrocallbusy=True
--> 457 return self._remoteInvocation(method, flags, *args)
458 self.__pyrocallbusy=False
459 finally:
460 if self.__pyrocallbusy:
461 # the call has been aborted before completion, close the connection
462 # to avoid corrupt transfers on the next call
463 self.release()
464
465 def _remoteInvocation(self, method, flags, *args):
466 if 'conn' not in self.__dict__.keys():
467 Log.error('PYROAdapter','no connection available in remoteinvocation')
468 raise ProtocolError('no connection available in remoteinvocation')
469 if method in self.onewayMethods:
470 flags |= Pyro.constants.RIF_Oneway
471 body=pickle.dumps((self.URI.objectID,method,flags,args),Pyro.config.PYRO_PICKLE_FORMAT)
472 try:
c:\python26\lib\site-packages\pyro-3.14-py2.6.egg\Pyro\protocol.pyc in _remoteInvocation(self=<Pyro.protocol.PYROAdapter object>, method='trait_names', flags=3, *args=((), {}))
517 __builtin__.__import__ = importer.orig_import
518 importer = None
519 self._retrieveCode(mname, 0)
520
521 finally:
522 if importer is not None:
523 __builtin__.__import__ = importer.orig_import
524 imp.release_lock()
525
526 if isinstance(answer,PyroExceptionCapsule):
527 if isinstance(answer.excObj,_InternalNoModuleError):
528 # server couldn't load the module, send it
529 return self.processMissingModuleError(answer.excObj, method, flags, args)
530 else:
531 # we have an encapsulated exception, raise it again.
--> 532 answer.raiseEx()
533 return answer
534
535 def processMissingModuleError(self, errorinfo, method, flags, args):
536 # server couldn't load module, supply it
537 # XXX this code is ugly. and duplicated in remote_retrieve_code in core.py
538 Log.msg('PYROAdapter',"server can't load module: "+errorinfo.modulename)
539 try:
540 importmodule=new.module('-agent-import-')
541 mname=errorinfo.modulename
542 # not used: fromlist=errorinfo.fromlist
543 try:
544 exec 'import '+mname in importmodule.__dict__
545 except ImportError:
546 Log.error('PYROAdapter','Server wanted a non-existing module:',mname)
547 raise PyroError('Server wanted a non-existing module',mname)
c:\python26\lib\site-packages\pyro-3.14-py2.6.egg\Pyro\errors.pyc in raiseEx(self=<Pyro.errors.PyroExceptionCapsule instance>)
57 # (constants.TRACEBACK_ATTRIBUTE), this is the *remote* traceback
58 # NOTE5: ---> this class is intentionally not subclassed from Exception,
59 # and also not from object.
60 # Pyro's exception handling depends on this!
61 #
62 #############################################################################
63
64 import Pyro.constants
65
66 class PyroExceptionCapsule: # don't make this a new style class
67 def __init__(self,excObj,args=None):
68 self.excObj = excObj
69 self.args=args # if specified, this is the remote traceback info
70 def raiseEx(self):
71 setattr(self.excObj,Pyro.constants.TRACEBACK_ATTRIBUTE,self.args)
---> 72 raise self.excObj
73 def __str__(self):
74 s=self.excObj.__class__.__name__
75 if not self.args:
76 return s
77 elif len(self.args) == 1:
78 return s+': '+str(self.args[0])
79 else:
80 return s+': '+str(self.args)
81 def __getitem__(self, i):
82 return self.args[i]
AttributeError: 'UL' object has no attribute 'trait_names'
***************************************************************************
History of session input:get_ipython().magic(u"run user_client.py")
*** Last line of input (may not be in above history):
get_ipython().magic(u"run user_client.py")
**********************************************************************
Oops, ipython crashed. We do our best to make it stable, but...
A crash report was automatically generated with the following information:
- A verbatim copy of the crash traceback.
- A copy of your input history during this session.
- Data on your current ipython configuration.
It was left in the file named:
'C:\Users\jstenar\.ipython\Crash_report_ipython.txt'
If you can email this file to the developers, the information in it will help
them in understanding and correcting the problem.
You can mail it to: Fernando Perez at fperez.net@gmail.com
with the subject 'ipython Crash Report'.
If you want to do it now, the following command will work (under Unix):
mail -s 'ipython Crash Report' fperez.net@gmail.com < C:\Users\jstenar\.ipython\
Crash_report_ipython.txt
To ensure accurate tracking of this issue, please file a report about it at:
http://github.com/ipython/ipython/issues
Readline internal error
Traceback (most recent call last):
File "c:\python\external\pyreadline-trunk\pyreadline\console\console.py", line
691, in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
File "c:\python\external\pyreadline-trunk\pyreadline\rlmain.py", line 567, in
readline
self._readline_from_keyboard()
File "c:\python\external\pyreadline-trunk\pyreadline\rlmain.py", line 532, in
_readline_from_keyboard
if self._readline_from_keyboard_poll():
File "c:\python\external\pyreadline-trunk\pyreadline\rlmain.py", line 552, in
_readline_from_keyboard_poll
result = self.mode.process_keyevent(event.keyinfo)
File "c:\python\external\pyreadline-trunk\pyreadline\modes\emacs.py", line 242
, in process_keyevent
r = self.process_keyevent_queue[-1](keyinfo)
File "c:\python\external\pyreadline-trunk\pyreadline\modes\emacs.py", line 285
, in _process_keyevent
r = dispatch_func(keyinfo)
File "c:\python\external\pyreadline-trunk\pyreadline\modes\basemode.py", line
255, in complete
completions = self._get_completions()
File "c:\python\external\pyreadline-trunk\pyreadline\modes\basemode.py", line
198, in _get_completions
r = ensure_unicode(self.completer(text, i))
File "c:\python\external\ipython\IPython\core\completer.py", line 864, in rlco
mplete
self.complete(text, line_buffer, cursor_pos)
File "c:\python\external\ipython\IPython\core\completer.py", line 795, in comp
lete
sys.excepthook(*sys.exc_info())
File "c:\python\external\ipython\IPython\core\crashhandler.py", line 157, in _
_call__
raw_input("Hit <Enter> to quit this message (your terminal may close):")
RuntimeError: can't re-enter readline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment