Skip to content

Console error #28

@zephyr111

Description

@zephyr111

Hello,

I just tried the plugin but it does not work with a relatively recent version of sublime text on my machine.
The sublime text console show the following error:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text\Lib\python33\sublime_plugin.py", line 948, in on_deactivated
    run_view_callbacks('on_deactivated', view_id)
  File "C:\Program Files\Sublime Text\Lib\python33\sublime_plugin.py", line 708, in run_view_callbacks
    callback(v, *args)
  File "C:\Program Files\Sublime Text\Lib\python33\sublime_plugin.py", line 152, in profiler
    return event_handler(*args)
  File "C:\Users\jrichard3\AppData\Roaming\Sublime Text\Installed Packages\Subforce - Perforce for Sublime.sublime-package\Subforce.py", line 352, in on_deactivated
    self.updateStatus(view)
  File "C:\Users\jrichard3\AppData\Roaming\Sublime Text\Installed Packages\Subforce - Perforce for Sublime.sublime-package\Subforce.py", line 362, in updateStatus
    with PerforceWrapper(squelchErrorAndWarninMessages=True) as p4:
  File "C:\Users\jrichard3\AppData\Roaming\Sublime Text\Installed Packages\Subforce - Perforce for Sublime.sublime-package\Subforce.py", line 66, in __init__
    projectPath = sublime.active_window().extract_variables()['folder']
KeyError: 'folder'

The key does not exist. I guess it has been deleted recently.
This cause the plugin not to be able to do a command on any file.

How to fix this:

sublime.active_window().extract_variables()['file_path'] can be used to get the file path of the current window and the containing folder can be extracted using os.path.dirname. This works on my machine with that.
It looks like the code Perforce.py on master is different and does not contains this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions