Sublime-Text-3-Perforce-Plugin icon indicating copy to clipboard operation
Sublime-Text-3-Perforce-Plugin copied to clipboard

Console error

Open zephyr111 opened this issue 3 years ago • 0 comments

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.

zephyr111 avatar Aug 31 '21 12:08 zephyr111