This project has moved and is read-only. For the latest updates, please go here.

interactive window completion failure with dictionary index containing two '-' characters


In the interactive window, completion throws an error when I try to call a method on the value of a dictionary that has as it's key a string containing two hyphens.

For example:
a = {'2001-01-01': numpy.arange(10)}
a['2001-01-01']  # correctly returns numpy array

a['2001-01-01'].  # Triggers completion but also throws an error
Below is the traceback. It's not entirely clear to me whether it's an issue with my ipython completion or the intellisense completion, however, this does not occur when I try the same thing in an ipython session in a normal console.

I'm running VS2012 Professional (11.0.61030.00) and PTVS 2.0.11016.00 along with Enthought Canopy python distribution (

error                                     Traceback (most recent call last)
C:\Users\n.thomas-peter\AppData\Local\Enthought\Canopy\User\lib\site-packages\IPython\core\completer.pyc in complete(self=<IPython.core.completer.IPCompleter object>, text=u"a['2001-01-01'].", line_buffer=u"a['2001-01-01'].", cursor_pos=1)
    899                 for matcher in self.matchers:
    900                     try:
--> 901                         self.matches.extend(matcher(text))
        self.matches.extend = <built-in method extend of list object at 0x000000000A96B188>
        matcher = <bound method IPCompleter.file_matches of <IPython.core.completer.IPCompleter object at 0x00000000065A3A20>>
        text = u"a['2001-01-01']."
    902                     except:
    903                         # Show the ugly traceback if the matcher causes an

C:\Users\n.thomas-peter\AppData\Local\Enthought\Canopy\User\lib\site-packages\IPython\core\completer.pyc in file_matches(self=<IPython.core.completer.IPCompleter object>, text=u"a['2001-01-01'].")
    583         # Compute the matches from the filesystem
--> 584         m0 = self.clean_glob(text.replace('\\',''))
        m0 = undefined
        self.clean_glob = <bound method IPCompleter._clean_glob_win32 of <IPython.core.completer.IPCompleter object at 0x00000000065A3A20>>
        text.replace = <built-in method replace of unicode object at 0x00000000069BCEA0>
    586         if has_protectables:

C:\Users\n.thomas-peter\AppData\Local\Enthought\Canopy\User\lib\site-packages\IPython\core\completer.pyc in _clean_glob_win32(self=<IPython.core.completer.IPCompleter object>, text=u"a['2001-01-01'].")
    522     def _clean_glob_win32(self,text):
    523         return [f.replace("\\","/")
--> 524                 for f in self.glob("%s*" % text)]
        f = undefined
        self.glob = <function glob at 0x0000000002617748>
        text = u"a['2001-01-01']."
    526     def file_matches(self, text):

C:\Program Files\Enthought\Canopy\App\appdata\\lib\glob.pyc in glob(pathname=u"a['2001-01-01'].*")
     15     """
---> 16     return list(iglob(pathname))
        global list = undefined
        global iglob = <function iglob at 0x0000000002618358>
        pathname = u"a['2001-01-01'].*"
     18 def iglob(pathname):

C:\Program Files\Enthought\Canopy\App\appdata\\lib\glob.pyc in iglob(pathname=u"a['2001-01-01'].*")
     28     dirname, basename = os.path.split(pathname)
     29     if not dirname:
---> 30         for name in glob1(os.curdir, basename):
        name = undefined
        global glob1 = <function glob1 at 0x00000000026183C8>
        global os.curdir = '.'
        basename = u"a['2001-01-01'].*"
     31             yield name
     32         return

C:\Program Files\Enthought\Canopy\App\appdata\\lib\glob.pyc in glob1(dirname=u'.', pattern=u"a['2001-01-01'].*")
     59     if pattern[0] != '.':
     60         names = filter(lambda x: x[0] != '.', names)
---> 61     return fnmatch.filter(names, pattern)
        global fnmatch.filter = <function filter at 0x00000000025FCA58>
        names = [u'documents', u'ia', u'live', u'monitoring', u'notebooks', u'research', u'wgef_hiscore.pyproj', u'wgef_hiscore.pyproj.user', u'wgef_hiscore.sln', u'wgef_hiscore.v11.suo']
        pattern = u"a['2001-01-01'].*"
     63 def glob0(dirname, basename):

C:\Program Files\Enthought\Canopy\App\appdata\\lib\fnmatch.pyc in filter(names=[u'documents', u'ia', u'live', u'monitoring', u'notebooks', u'research', u'wgef_hiscore.pyproj', u'wgef_hiscore.pyproj.user', u'wgef_hiscore.sln', u'wgef_hiscore.v11.suo'], pat=u"a['2001-01-01'].*")
     52         if len(_cache) >= _MAXCACHE:
     53             _cache.clear()
---> 54         _cache[pat] = re.compile(res)
        global _cache = {u'plt.*': <_sre.SRE_Pattern object at 0x0000000008CC3E70>, u'*.py': <_sre.SRE_Pattern object at 0x00000000067931B0>, u'np.*': <_sre.SRE_Pattern object at 0x00000000069635D0>, u'*.ipy': <_sre.SRE_Pattern object at 0x00000000067480B8>}
        pat = u"a['2001-01-01'].*"
        global re.compile = <function compile at 0x0000000002287E48>
        res = u"a['2001-01-01']\\..*\\Z(?ms)"
     55     match=_cache[pat].match
     56     if os.path is posixpath:

C:\Program Files\Enthought\Canopy\App\appdata\\lib\re.pyc in compile(pattern=u"a['2001-01-01']\\..*\\Z(?ms)", flags=0)
    188 def compile(pattern, flags=0):
    189     "Compile a regular expression pattern, returning a pattern object."
--> 190     return _compile(pattern, flags)
        global _compile = <function _compile at 0x0000000002289048>
        pattern = u"a['2001-01-01']\\..*\\Z(?ms)"
        flags = 0
    192 def purge():

C:\Program Files\Enthought\Canopy\App\appdata\\lib\re.pyc in _compile(*key=(u"a['2001-01-01']\\..*\\Z(?ms)", 0))
    240         p = sre_compile.compile(pattern, flags)
    241     except error, v:
--> 242         raise error, v # invalid expression
        global error = <class 'sre_constants.error'>
        v = error('bad character range',)
    243     if len(_cache) >= _MAXCACHE:
    244         _cache.clear()

error: bad character range