0

I'm trying to run the code:

n, k = input().split()
dk = 0


for i in int(n):
    j = int(input())
    if j % int(k) == 0:
        dk += 1

print(dk)

But sublime REPL is giving this output:

tab 1 of window id 684
[Finished in 192ms]

I'm using the build system:

{
"shell_cmd": "osascript -e 'tell app \"Terminal\" to do script \"cd $file_path && python3 -u $file\"'",
"working_dir": "$file_path",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "utf-8"}
}

Can anyone help me out?

Draculin
  • 25
  • 1
  • 7
  • Your build is asking apple script to run your program in an external terminal, in which case the only output that's available for SublimeREPL to display is the output of the command you asked it to run, which is `osascript`. Why are you using SublimeREPL to run another program to run your code externally instead of just running it directly? There's no advantage at all to using SublimeREPL if you're going to do that. – OdatNurd Sep 21 '21 at 08:19
  • @OdatNurd To give input. Sublime output cannot accept input – Draculin Sep 22 '21 at 14:53
  • Technically true, but in that case you're doing it wrong. Your build is saying "Hey Apple Script, would you please tell the Terminal application that is external to Sublime Text to please run this script?". In which case your program runs in Terminal and you can interact with it. You don't need SublimeREPL to ask an external program to do something, that's just what builds do in general. In short, you either want your `shell_cmd` to just run Python, or you want a non-SublimeREPL build to do what this one is doing. You're going across purposes here. – OdatNurd Sep 22 '21 at 16:05
  • @OdatNurd I used REPL for the longest time in windows for convenience but I'm new to mac and whatever I try it doesn't work. I've just migrated to VSCode for now – Draculin Sep 24 '21 at 04:07

0 Answers0