Sublime Forum

Defining WindowCommand will grey out many menuitems

#1

My Sublime version is 4. The following snippet will cause many menuitems to be greyed out.

Is this a bug? Thanks!

import sublime
import sublime_plugin

class TestCommand(sublime_plugin.WindowCommand):
	def __init__(self, window):
		super(TestCommand, self).__init__(window)
		self.view = self.window.create_output_panel("mypanel")

Untitled

0 Likes

#2

Can’t reproduce, 4109. I support there will be some errors in the console?

Btw, you can test it either under Safe Mode or a new clean portable ST 4.

0 Likes

#3

Hi, Thanks for your reply. I can still reproduce it on my new Windows 7 virtual machine with a fresh downloaded portable ST4.

0 Likes

#5

That screenshot helps A LOT. I noticed that you save the file under Packages/, which runs under py33, while mine is under Packages/User/, which auto runs under py38 by default.

I can reproduce your issue now.


@bschaaf This may be why some users have greyed menus.

0 Likes

#6

Wow! Great!

By the way, how the ST determines which python version to load. I want to load python 3.8 as a workaround. Thanks! @jfcherng

0 Likes

#7

how the ST determines which python version to load

If you create a .python-version file whose content is 3.8, then scripts under that same directory will runs under py38. Otherwise, ST4 runs them in py33 for backward compatibility.

I personally put all my small py38 scripts under Packages/my_plugin38.

0 Likes

#8

Another hint, under Windows 7, in explorer, to create a file whose name starts with dot without a file extension, you can add an extra dot at the end of its name like .python-version. and the ending dot will be auto trimmed.

Win10 seems having that fixed, at least on my side.

0 Likes

#9

Awesome!

.python-version works. Many thanks!

0 Likes

#10

I use Git Bash for Windows to create a dot file. This would be more convenient.

0 Likes

#11

Me too actually (git-bash under Windows Terminal) :wink:

0 Likes

#12

:stuck_out_tongue_winking_eye:

0 Likes

#13

Thanks for finding that, I’ve submitted a fix :slight_smile:

1 Like

#14

Thanks :smile: @bschaaf

0 Likes