0

I am having an issue with ITerm2 on OSX Mojave. I have a long-lived python script running in the background and for some reason the OS or ITerm/ZSH keeps pausing the application and a Key Icon appears in the terminal -- which you can only bypass by pressing the return key. This application is going to take roughly 10 hours to finish processing and I can't just sit there and press enter every time the icon appears. Does anyone have an idea of what could be causing this and how to get around it?

Michael Scott
  • 539
  • 3
  • 8
  • 18

1 Answers1

1

Your Python script is prompting for input of some kind. It's impossible to say what hitting return actually does (is input being used simply to pause before continuing, or is it asking for some actual value, but an empty input accepts some hard-coded default), but you can simulate it.

Instead of running

python myScript.py &

run

yes "" | python myScript.py &

yes will provide an infinite stream of empty strings for your script to read each time it tries to read input.

chepner
  • 497,756
  • 71
  • 530
  • 681
  • While the python script definitely is not prompting for user input, I wasn't aware of the yes command and thanks for the pointer! I'll try it like that. – Michael Scott Dec 11 '19 at 15:28
  • I'd be leery of doing this without first understanding why your script is asking for input (or knowing what your script runs that is asking). Who knows what hitting return is really doing? – chepner Dec 11 '19 at 15:35
  • 1
    The key icon, IIRC, indicates it's asking for a password. I don't recall how iTerm determines if that's the case. (Basically, it just means that input won't be echoed to the terminal.) – chepner Dec 11 '19 at 15:37
  • So I just did some in-depth analysis, and the python script I created imports an external module, which runs some shell commands -- one of which, it turns out, prompts for a password for decrypting a zip archive. Thanks for the help! – Michael Scott Dec 11 '19 at 16:27