Introduction
I am developping a sublime text 3 package.
Suddenly, the command I am adding the the package broke. It throws every time the following error in the console:
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 1456, in run_
return self.run(**args)
TypeError: run() got an unexpected keyword argument 'redeploy_module'
This appears in “dirty” sublime as well as in clean state.
This happens when I add a list input handler.
This works
class ProjectNameInputHandler(sublime_plugin.TextInputHandler):
def placeholder(self):
return "Project's name - must already exist"
# def next_input(self, args):
# if 'module' not in args:
# return RedeployModuleInputHandler()
# class RedeployModuleInputHandler(sublime_plugin.ListInputHandler):
# def placeholder(self):
# return "Module to create template for"
# def list_items(self):
# return [("Manager (v1)", "manager"),
# ("Projects (v2)", "projects")]
class RedeployJobCommand(sublime_plugin.WindowCommand):
def run(self, project_name):
plugin_path = str(os.path.dirname(__file__))
template_cli = "\"{}\\template-python-cli\\cli.py\""\
.format(plugin_path)
folder = self.window.extract_variables()['folder']
args = "redeployJob {}".format(project_name)
command = "echo 'python {} {}'".format(template_cli, args)
self.window.run_command("exec", {
"shell_cmd": command,
"working_dir": folder
})
def input(self, args):
if 'project_name' not in args:
return ProjectNameInputHandler()
# elif 'module' not in args:
# return RedeployModuleInputHandler()
This does not work
import sublime_plugin
import os
class ProjectNameInputHandler(sublime_plugin.TextInputHandler):
def placeholder(self):
return "Project's name - must already exist"
def next_input(self, args):
if 'module' not in args:
return RedeployModuleInputHandler()
class RedeployModuleInputHandler(sublime_plugin.ListInputHandler):
def placeholder(self):
return "Module to create template for"
def list_items(self):
return [("Manager (v1)", "manager"),
("Projects (v2)", "projects")]
class RedeployJobCommand(sublime_plugin.WindowCommand):
def run(self, project_name, module):
plugin_path = str(os.path.dirname(__file__))
template_cli = "\"{}\\template-python-cli\\cli.py\""\
.format(plugin_path)
folder = self.window.extract_variables()['folder']
args = "redeployJob {}".format(project_name)
command = "echo 'python {} {}'".format(template_cli, args)
self.window.run_command("exec", {
"shell_cmd": command,
"working_dir": folder
})
def input(self, args):
if 'project_name' not in args:
return ProjectNameInputHandler()
elif 'module' not in args:
return RedeployModuleInputHandler()
It throws the error described in the introduction.
I do not understand why it does that. What I am doing wrong ?