Home Download Buy Blog Forum Support

TypeError: Value required

TypeError: Value required

Postby phyllisstein on Sat Feb 02, 2013 5:18 am

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:

Code: Select all
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:
Code: Select all
self.window.run_command("pandown_exec", {"cmd": cmd, "env": env})

but breaks if I call this:
Code: Select all
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!
phyllisstein
 
Posts: 49
Joined: Fri Aug 24, 2012 5:28 am

Re: TypeError: Value required

Postby quarnster on Sat Feb 02, 2013 6:25 am

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.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: TypeError: Value required

Postby phyllisstein on Sat Feb 02, 2013 7:16 am

quarnster wrote: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.


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!
phyllisstein
 
Posts: 49
Joined: Fri Aug 24, 2012 5:28 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests