Home Download Buy Blog Forum Support

Why is "sys.argv" not available?

Why is "sys.argv" not available?

Postby raorao on Mon Aug 27, 2012 2:22 pm

Dear forum!

I wrote the following little Plugin to illustrate, that sys.argv is not working on my Ubuntu 12.04, Subulime-Text2 v.2.0.1:

Code: Select all
import sublime, sublime_plugin
import sys

class TestCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        print dir(sys)
        print sys.argv

You can test the plugin by copying it into sublime_packages_dir/User and then pressing ctrl+` to open the python console and typing:
Code: Select all

I get the following output:
Code: Select all
>>> view.run_command('test')
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__package__', '__stderr__', '__stdin__', '__stdout__', '_clear_type_cache', '_current_frames', '_getframe', 'api_version', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', 'exec_prefix', 'executable', 'exit', 'exitfunc', 'flags', 'float_info', 'getcheckinterval', 'getdefaultencoding', 'getdlopenflags', 'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'gettrace', 'hexversion', 'last_traceback', 'last_type', 'last_value', 'maxint', 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'py3kwarning', 'setcheckinterval', 'setdlopenflags', 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'subversion', 'version', 'version_info', 'warnoptions']

Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./myTestPlugin.py", line 8, in run
AttributeError: 'module' object has no attribute 'argv'

Is there any reason why this is not available?
Thanks a lot for any help!
Posts: 1
Joined: Mon Aug 27, 2012 2:15 pm

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 3 guests