Sublime Forum

TypeError: Value required

#1

Hello, pluggers-in:
I’m running into a “TypeError: Value required” exception trying to call a command, and I can’t for the life of me figure out how to fix it. JPS’s post here seemed to suggest that I should define all of the target “run” method’s arguments, but that didn’t solve the problem. I sort of hope I’m just doing something dumb.

The deets: I’ve got a command built on the default “exec” command. I was trying to modify it so that the called process’ stdout would be passed back to a normal Sublime view. So the command’s run method is defined like this:

class PandownExecCommand(sublime_plugin.WindowCommand, PandownProcessListener): def run(self, cmd=None, env={}, file_regex="", line_regex="", encoding="utf-8", quiet=False, kill=False, word_wrap=True, syntax="Packages/Text/Plain text.tmLanguage", working_dir="", output_view=None, **kwargs):

This seems to work fine if I call this:

self.window.run_command("pandown_exec", {"cmd": cmd, "env": env})

but breaks if I call this:

self.window.run_command("pandown_exec", {"cmd": cmd, "env": env, "output_view": outView})

I’ve tried extending that second run_command to include every possible argument to run, but to no avail.

I can provide more (sloppy) code if needed, but those are the basics. Does anything jump out at anyone? Thanks in advance!

0 Likes

#2

You can’t pass a view as it’s not a value. You’ll either have to pass view.id() and then look that up or set a global variable somewhere and use that instead passing it as a function argument.

0 Likes

#3

Fantastic! I’m so glad it was something stupid. Passing the id and then searching for it on the other end did the trick. Thank you so much!

0 Likes