I am using Python 2.6 on Windows 7. I have a Windows.cmd file that calls Python to start the CherryPy web server (version 3.1.2). I run this .cmd file by running it on the command line in the Windows CMD shell. When CherryPy notices that one of its dependent files has changed, it restarts. There are a couple of problems encountered in this configuration on Windows, because the call that CherryPy uses to reboot is
os.execv(sys.executable, args)
but you cannot invoke the Python executable in the .cmd file. I managed to get around this problem with a variety of gymnastics in Python, and now I have to restart it by calling (essentially)
os.execv(sys.argv[0], args)
But the restarted process disconnects from the keyboard; he will catch Ctrl-C and then they will ask me
Terminate batch job (Y/N)?
but type Y or N I am caught not by the ending .cmd file, but by the Windows CMD shell, and it responds
'Y' is not recognized as an internal or external command, operable program or batch file.
So, how do I set things up on Windows to restart the process in what I would call the โforegroundโ on Unix?
source share