-1

So far i have the following build system which i found online:

{
 "cmd": ["python3", "-u", "$file"],
 "file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
 "selector": "source.python"
}

But it doesn't work. After i have supplied my input and then press ENTER the cursor just moves down to the next line. If i continue pressing ENTER the cursor continues moving down.Basically, it does not capture my input.

  • I believe this will help: https://stackoverflow.com/a/19732557/4822470 – Joshua May 13 '20 at 02:29
  • Can you elaborate on how your code "doesn't work"? What were you expecting, and what actually happened? If you got an exception/error, post the line it occurred on and the exception/error details which can be done with a [mre]. Please [edit] your question to add these details into it or we may not be able to help. – rizerphe May 13 '20 at 04:19

1 Answers1

0

As suggested by @Joshua, you can use SublimeREPL. Alternatively, if you want to solve it with a custom build system, you should make a build system that executes the python script through an external terminal (as the output panel in Sublime only displays output, without listening to input). Most terminal applications have an option to execute a provided command. For instance, if you use terminator for your terminals, you can use the following build system:

{
    "shell_cmd": "terminator -p sublime -e \"python -u $file; echo [Finished with exit code \\$?]\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
}

It executes your python script in a terminator terminal. The sublime profile provided through the -p option is a custom terminator profile with the When command exists - Hold the terminal open-option enabled.

asparc
  • 136
  • 2