Sublime Forum

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

#1

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:

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:

    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

0 Likes

#2

More info… content of “CTags.sublime-settings”:

{
    // 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

0 Likes

#3

After reading some Python documentation, I deduce that mmap() complains about not being able to iterate over an empty set. Thus I suspect that:

open(self.p, 'r+')

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

– Teuxe

0 Likes