Sublime Forum

Kill: true not killing Python with GUI windows

#1

I have a very simple problem. I am trying to use Sublime Text 2 for Python development and I’m writing a program where it calls a matplotlib GUI window.

Something as simple as:

[code]import matplotlib.pyplot as plt
import time

plt.ion()
plt.axis( [0, 1, 0, 1] )
plt.axes().set_aspect( ‘equal’ )
plt.show()

time.sleep( 1000 )
[/code]

My problem is that I cannot kill this window. I’ve changed my keybinding to allow kill: true,

and it kind of kills the process, but python.exe stays running and the GUI window stays open. It seems the only way to kill the running process it from Task Manager.

Can you help me how to fix it? I’d like to have something similar to Shift + F2 in PyScripter, what could just kill these Python scripts.

0 Likes

#2

What’s your sublime-build file ?
Do you use the “shell” argument ?

0 Likes

#3

[quote=“bizoo”]What’s your sublime-build file ?
Do you use the “shell” argument ?[/quote]

The default one:

[quote]{
“cmd”: “python”, “-u”, “$file”],
“file_regex”: “^ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”,
“shell”: “true”
} [/quote]

0 Likes

#4

OK, so I suppose kill actually terminate the cmd.exe process, and not the python.exe process.
Try to create a new build file with:

{ "cmd": "c:\python27\python.exe", "-u", "$file"], "file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python" }
and replace cmd with the correct python path.

Not tested at all…

0 Likes