get_expression should only be called if index is inside a code

Bug #732891 reported by Rune Juhl Jacobsen on 2011-03-10
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

When typing the following code, I got the error below (** denotes cursor position -- as indicated, I pressed the tab key):

import sys
from PIL import Image
o ="oxygen.** <TAB>
s = ''

  File "/usr/share/dreampie/dreampielib/gui/", line 558, check_autocomplete(self=DreamPie(path..."window_main"), last_char='.')
    {'False': False, 'True': True, 'is_auto': [], 'complete': [], 'self.autocomplete.show_completions': <bound method Autocomplete.show_completions of <dreampielib.gui.autocomplete.Autocomplete object at 0x152b510>>}
  File "/usr/share/dreampie/dreampielib/gui/", line 72, show_completions(self=<dreampi...x152b510>, is_auto=True, complete=False)
    {'index': 56, 'is_auto': True, 'res': [], 'hp': <dreampielib.gui.hyper_parser.HyperParser object at 0x152ba90>, 'text': u'import sys\nfrom PIL import Image\no ="oxygen.\ns = \'\'\nfor x in range(0,o.size[0]+1)[::7]:\n for y in range(o.size[1]/2-1, o.size[1]/2):\n s = s + chr(pix[x,y][0])\n \nprint s[0:-3]\nt = eval(s[42:-3])\nfor u in t:\n sys.stdout.write(chr(u))', 'self._complete_attributes': <bound method Autocomplete._complete_attributes of <dreampielib.gui.autocomplete.Autocomplete object at 0x152b510>>}
  File "/usr/share/dreampie/dreampielib/gui/", line 133, _complete_attributes(self=<dreampi...x152b510>, text=u'import...(chr(u))', index=56, hp=<dreampi...x152ba90>, is_auto=True)
    {'hp.get_expression': <bound method HyperParser.get_expression of <dreampielib.gui.hyper_parser.HyperParser object at 0x152ba90>>, 'comp_what': []}
  File "/usr/share/dreampie/dreampielib/gui/", line 141, get_expression(self=<dreampi...x152ba90>)
    {'ValueError': <type 'exceptions.ValueError'>}

Traceback (most recent call last):
  File "/usr/share/dreampie/dreampielib/gui/", line 558, in check_autocomplete
    self.autocomplete.show_completions(is_auto=True, complete=False)
  File "/usr/share/dreampie/dreampielib/gui/", line 72, in show_completions
    res = self._complete_attributes(text, index, hp, is_auto)
  File "/usr/share/dreampie/dreampielib/gui/", line 133, in _complete_attributes
    comp_what = hp.get_expression()
  File "/usr/share/dreampie/dreampielib/gui/", line 141, in get_expression
    raise ValueError("get_expression should only be called if index "\
ValueError: get_expression should only be called if index is inside a code.

Related branches

Noam Yorav-Raphael (noamraph) wrote :

Thanks for the report!

Confirmed on trunk.

Changed in dreampie:
status: New → Confirmed
Noam Yorav-Raphael (noamraph) wrote :

Fixed in revision 223. Now the parser ignores the rest of the code, which seems like the right thing to do.

Changed in dreampie:
status: Confirmed → Fix Committed
Changed in dreampie:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers