0

I've searched hard, but not found exactly what I need. I want to run python3 programs in a terminal from sublime3 using CTRL+B and for the terminal to remain open after the code has run.

{
    "cmd": ["start", "cmd", "/k", "usr/bin/python3", "$file"],
    "selector": "source.python",
    "shell": true,
    "working_dir": "$file_dir"
}

gives start: missing job name

{
"cmd": ["gnome-terminal -e 'bash -c \"python3 -u $file;echo;echo Press ENTER to exit; read line\"'"],
"shell": true
}

works, but doesn't keep terminal open.

I've seen "/k" somewhere in this connection, but have no idea whare I would put it.

As usual, any help much appreciated.

Robin Andrews
  • 3,514
  • 11
  • 43
  • 111

2 Answers2

0

try:

{
    "cmd": ["gnome-terminal -e 'bash -c \"python3 -u $file &&;\"'"],
    "shell": true
}
emberdex
  • 355
  • 1
  • 7
  • Sadly not working. Terminal flashes up and instantly disapears with sublime displaying: "(gnome-terminal:2565): GLib-GIO-CRITICAL **: g_settings_get: the format string may not contain '&' (key 'monospace-font-name' from schema 'org.gnome.desktop.interface'). This call will probably stop working with a future version of glib. [Finished in 0.4s]" displays. Any other suggestions? – Robin Andrews Apr 27 '16 at 08:14
  • { "cmd": ["gnome-terminal -e 'bash -c \"python3 -u $file;bash\"'"], "shell": true } works, but doesn't keep the interpreter running, just keeps the terminal open. – Robin Andrews Apr 29 '16 at 15:04
0
{
"cmd": ["gnome-terminal -e 'bash -c \"python3 -i -u $file;bash\"'"],
"shell": true
}

did the trick. -i keeps the interpreter open, bash keeps the terminal open. Can't find out what -u does anywhere though...

Robin Andrews
  • 3,514
  • 11
  • 43
  • 111