-
-
Save JeffCarpenter/ab1d0f3dcff1ef3568a9 to your computer and use it in GitHub Desktop.
IPython crash on autocompleting "sqlalchemy.func.row_number."
SQLAlchemy version 0.8.1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*************************************************************************** | |
IPython post-mortem report | |
{'commit_hash': '<not found>', | |
'commit_source': '(none found)', | |
'ipython_path': '/usr/lib/python2.7/dist-packages/IPython', | |
'ipython_version': '0.12.1', | |
'os_name': 'posix', | |
'platform': 'Linux-3.2.0-23-generic-x86_64-with-Ubuntu-12.04-precise', | |
'sys_executable': '/usr/bin/python', | |
'sys_platform': 'linux2', | |
'sys_version': '2.7.3 (default, Aug 1 2012, 05:14:39) \n[GCC 4.6.3]'} | |
*************************************************************************** | |
*************************************************************************** | |
Crash traceback: | |
--------------------------------------------------------------------------- | |
NotImplementedError Python 2.7.3: /usr/bin/python | |
Fri Jul 26 17:42:56 2013 | |
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/lib/python2.7/dist-packages/IPython/core/completer.pyc in complete(self=<IPython.core.completer.IPCompleter object>, text='func.row_number.', line_buffer='func.row_number.', cursor_pos=16) | |
800 | |
801 # Start with a clean slate of completions | |
802 self.matches[:] = [] | |
803 custom_res = self.dispatch_custom_completer(text) | |
804 if custom_res is not None: | |
805 # did custom completers produce something? | |
806 self.matches = custom_res | |
807 else: | |
808 # Extend the list of completions with the results of each | |
809 # matcher, so we return results to the user from all | |
810 # namespaces. | |
811 if self.merge_completions: | |
812 self.matches = [] | |
813 for matcher in self.matchers: | |
814 try: | |
--> 815 self.matches.extend(matcher(text)) | |
self.matches.extend = <built-in method extend of list object at 0x2bcc878> | |
matcher = <bound method IPCompleter.python_matches of <IPython.core.completer.IPCompleter object at 0x1421b90>> | |
text = 'func.row_number.' | |
816 except: | |
817 # Show the ugly traceback if the matcher causes an | |
818 # exception, but do NOT crash the kernel! | |
819 sys.excepthook(*sys.exc_info()) | |
820 else: | |
821 for matcher in self.matchers: | |
822 self.matches = matcher(text) | |
823 if self.matches: | |
824 break | |
825 # FIXME: we should extend our api to return a dict with completions for | |
826 # different types of objects. The rlcomplete() method could then | |
827 # simply collapse the dict into a list for readline, but we'd have | |
828 # richer completion semantics in other evironments. | |
829 self.matches = sorted(set(self.matches)) | |
830 #io.rprint('COMP TEXT, MATCHES: %r, %r' % (text, self.matches)) # dbg | |
/usr/lib/python2.7/dist-packages/IPython/core/completer.pyc in python_matches(self=<IPython.core.completer.IPCompleter object>, text='func.row_number.') | |
594 if ' ' in main_text and not main_text.startswith('sudo'): | |
595 return [] | |
596 text = os.path.expanduser(text) | |
597 aliases = self.alias_table.keys() | |
598 if text == '': | |
599 return aliases | |
600 else: | |
601 return [a for a in aliases if a.startswith(text)] | |
602 | |
603 def python_matches(self,text): | |
604 """Match attributes or global python names""" | |
605 | |
606 #io.rprint('Completer->python_matches, txt=%r' % text) # dbg | |
607 if "." in text: | |
608 try: | |
--> 609 matches = self.attr_matches(text) | |
matches = undefined | |
self.attr_matches = <bound method IPCompleter.attr_matches of <IPython.core.completer.IPCompleter object at 0x1421b90>> | |
text = 'func.row_number.' | |
610 if text.endswith('.') and self.omit__names: | |
611 if self.omit__names == 1: | |
612 # true if txt is _not_ a __ name, false otherwise: | |
613 no__name = (lambda txt: | |
614 re.match(r'.*\.__.*?__',txt) is None) | |
615 else: | |
616 # true if txt is _not_ a _ name, false otherwise: | |
617 no__name = (lambda txt: | |
618 re.match(r'.*\._.*?',txt) is None) | |
619 matches = filter(no__name, matches) | |
620 except NameError: | |
621 # catches <undefined attributes>.<tab> | |
622 matches = [] | |
623 else: | |
624 matches = self.global_matches(text) | |
/usr/lib/python2.7/dist-packages/IPython/core/completer.pyc in attr_matches(self=<IPython.core.completer.IPCompleter object>, text='func.row_number.') | |
343 m2 = re.match(r"(.+)\.(\w*)$", self.line_buffer) | |
344 if not m2: | |
345 return [] | |
346 expr, attr = m2.group(1,2) | |
347 else: | |
348 return [] | |
349 | |
350 try: | |
351 obj = eval(expr, self.namespace) | |
352 except: | |
353 try: | |
354 obj = eval(expr, self.global_namespace) | |
355 except: | |
356 return [] | |
357 | |
--> 358 words = dir2(obj) | |
words = undefined | |
global dir2 = <function dir2 at 0x113fb90> | |
obj = <sqlalchemy.sql.expression._FunctionGenerator object at 0x279de90> | |
359 | |
360 try: | |
361 words = generics.complete_object(obj, words) | |
362 except TryNext: | |
363 pass | |
364 except Exception: | |
365 # Silence errors from completion function | |
366 #raise # dbg | |
367 pass | |
368 # Build match list to return | |
369 n = len(attr) | |
370 res = ["%s.%s" % (expr, w) for w in words if w[:n] == attr ] | |
371 return res | |
372 | |
373 | |
/usr/lib/python2.7/dist-packages/IPython/utils/dir2.pyc in dir2(obj=<sqlalchemy.sql.expression._FunctionGenerator object>) | |
48 # with a few extra special-purpose calls. | |
49 words = dir(obj) | |
50 | |
51 if hasattr(obj,'__class__'): | |
52 words.append('__class__') | |
53 words.extend(get_class_members(obj.__class__)) | |
54 #if '__base__' in words: 1/0 | |
55 | |
56 # Some libraries (such as traits) may introduce duplicates, we want to | |
57 # track and clean this up if it happens | |
58 may_have_dupes = False | |
59 | |
60 # this is the 'dir' function for objects with Enthought's traits | |
61 if hasattr(obj, 'trait_names'): | |
62 try: | |
---> 63 words.extend(obj.trait_names()) | |
words.extend = <built-in method extend of list object at 0x2bcc7e8> | |
obj.trait_names = <sqlalchemy.sql.expression._FunctionGenerator object at 0x1f14e90> | |
64 may_have_dupes = True | |
65 except TypeError: | |
66 # This will happen if `obj` is a class and not an instance. | |
67 pass | |
68 except AttributeError: | |
69 # `obj` lied to hasatter (e.g. Pyro), ignore | |
70 pass | |
71 | |
72 # Support for PyCrust-style _getAttributeNames magic method. | |
73 if hasattr(obj, '_getAttributeNames'): | |
74 try: | |
75 words.extend(obj._getAttributeNames()) | |
76 may_have_dupes = True | |
77 except TypeError: | |
78 # `obj` is a class and not an instance. Ignore | |
/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/operators.pyc in __iter__(self=<sqlalchemy.sql.expression.Function at 0x279df50; trait_names>) | |
NotImplementedError: Class <class 'sqlalchemy.sql.expression.Function'> is not iterable | |
*************************************************************************** | |
History of session input:q=session.query(SlideNode, func.row_number().over(order_by=[SlideNode.a, SlideNode.b, SlideNode.c, SlideNode.d, SlideNode.slide_id]))q.limit(10).all()q.limit(10).all()q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title'))q.all()q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).filter_by(id<1)q=session.query(TreeNode, label('n', func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')))q=session.query(TreeNode, label('n', func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')))from sqlalchemy.orm.extensions import labelfrom sqlalchemy.orm.extension import labelfrom sqlalchemy.orm import labelq=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).filter_by(id<1)q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title'))q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).first()q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).first()q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).first()q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).all()q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title')).all()qq=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title'))q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id]).label).filter(TreeNode.type.has(safename='page_title'))q=session.query(TreeNode, func.row_number().over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title'))qq.first()foo=q.first()q.column_descriptionsq=session.query(TreeNode, func.row_number().label('n').over(order_by=[TreeNode.a, TreeNode.b, TreeNode.c, TreeNode.d, TreeNode.slide_id])).filter(TreeNode.type.has(safename='page_title'))get_ipython().magic(u'pinfo func.row_number')func.row_number.__dict__func.row_number.over.func.row_number.overfunc.row_number.over.func.row_number.over.func.row_number.get_ipython().magic(u'config Application.verbose_crash')get_ipython().magic(u'config Application.verbose_crash=True') | |
*** Last line of input (may not be in above history): | |
get_ipython().magic(u'config Application.verbose_crash=True') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment