Sublime Forum

Linux strange behavior

#1

I’m working on my first plugin and found bug in linux version:
This plugin code will hang up my vmware’s linux box (xubuntu 12.04)

import sublime, sublime_plugin, threading

def crashThread(test):
	sublime.active_window().open_file("/home/cheatfate/Documents/test.txt")
	sublime.active_window().open_file("/home/cheatfate/Documents/test.txt")
	sublime.active_window().open_file("/home/cheatfate/Documents/test.txt")

class crashmeCommand(sublime_plugin.WindowCommand):
	def run(self):
		thread = threading.Thread(target=crashThread, args=("", ))
		thread.start()

but when i run this code on Windows i’ve got a message in console:

Exception in thread Thread-1:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File ".\crashme.py", line 4, in crashThread
RuntimeError: Must call on main thread, consider using sublime.set_timeout(function, timeout)

May be it is possible to make some changes to Linux version to obtain this message too?

0 Likes