Home Download Buy Blog Forum Support

[CTags] Jumping to def: 'NoneType' object is not iterable

[CTags] Jumping to def: 'NoneType' object is not iterable

Postby Teuxe on Tue Apr 02, 2013 12:13 pm

Hi,

I noticed that my installation of Sublime Text 2 on Windows XP does not handle CTags jumps anymore (ctrl+t ctrl+t was jumping to definition of C code), probably due to a recent update (or maybe user settings, I don't know). Looking at the console, when pressing this key combination, the following error is logged:
'NoneType' object is not iterable
Traceback (most recent call last):
File ".\sublime_plugin.py", line 362, in run_
File ".\ctagsplugin.py", line 456, in command
File ".\ctagsplugin.py", line 548, in run
File ".\ctagsplugin.py", line 493, in run
File ".\ctags.py", line 280, in get_tags_dict
File ".\ctags.py", line 59, in parse_tag_lines
File ".\ctags.py", line 221, in get
WindowsError:


I don't know the Python language... what I can say is that the log refers to the mmap.mmap() line of the class TagFile (ctags.py) below:
Code: Select all
    def get(self, *tags):
        with open(self.p, 'r+') as fh:
            if tags:
                self.fh = mmap.mmap(fh.fileno(), 0)

                for tag in (t.encode() for t in tags):
                    b4 = bisect.bisect_left(self, tag)
                    fh.seek(b4)

                    for l in self.match_as(fh, tag):
                        yield l

                self.fh.close()
            else:
                for l in fh.readlines():
                    yield l


Could someone give me clues? Is it a Windows-only issue? Which lines of code could I insert to debug that stuff?
Thanks,

-- Teuxe
Teuxe
 
Posts: 4
Joined: Tue Apr 02, 2013 12:02 pm

Re: [CTags] Jumping to def: 'NoneType' object is not iterable

Postby Teuxe on Tue Apr 02, 2013 12:38 pm

More info... content of "CTags.sublime-settings":

Code: Select all
{
    // All options in here can also be specified in your project settings
    // with a prepended "ctags_" for example if you have
    //
    // "settings":
    // {
    //     "ctags_command": ""echo \":ctags .tags\" | ghci -v0 /path/to/Main.hs"
    // }
    //
    // in your project settings, this will override the settings specified
    // in this file and in your user settings.

    "debug"           :  false,
    "autocomplete": false,
    "command"   :  "ctags -R -f .tags",
    "filters"         :  {
        "source.python": {"type":"^i$"}
    },
    "definition_filters": {
        "source.php": {"type":"^v$"}
    },
    "definition_current_first": true,
    "show_context_menus": true,
    //"extra_tag_paths" :  [ [["source.python", "windows"], "S:\\Python27\\Lib\\tags"]],
    "extra_tag_files" : [".gemtags", "tags"]
}


Note also that the generation of the ".tags" file (via ctrl+t ctrl+r) was successful.

-- Teuxe
Teuxe
 
Posts: 4
Joined: Tue Apr 02, 2013 12:02 pm

Re: [CTags] Jumping to def: 'NoneType' object is not iterable

Postby Teuxe on Tue Apr 02, 2013 12:53 pm

After reading some Python documentation, I deduce that mmap() complains about not being able to iterate over an empty set. Thus I suspect that:
Code: Select all
open(self.p, 'r+')

fails at opening the file? How can I dump the value of "self.p" on ST2 console?

-- Teuxe
Teuxe
 
Posts: 4
Joined: Tue Apr 02, 2013 12:02 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 27 guests