Re: Program chaining on Windows

2020-08-24 Thread Rob Cliffe via Python-list
On 24/08/2020 19:54, Terry Reedy wrote: On 8/23/2020 3:31 AM, Rob Cliffe via Python-list wrote: On WIndows 10, running Python programs in a DOS box, Please don't use 'DOS box' for Windows Command Prompt or other Windows consoles for running Windows programs from a command line.  DOSBox is

Re: Program chaining on Windows

2020-08-24 Thread Rob Cliffe via Python-list
On 24/08/2020 13:20, Eryk Sun wrote: You can work with job objects via ctypes or PyWin32's win32job module. I can provide example code for either approach. No need, I'm already convinced that this is not the way for me to go. from the DOS prompt, it works as expected. You're not running D

Re: Program chaining on Windows

2020-08-24 Thread Terry Reedy
On 8/23/2020 3:31 AM, Rob Cliffe via Python-list wrote: On WIndows 10, running Python programs in a DOS box, Please don't use 'DOS box' for Windows Command Prompt or other Windows consoles for running Windows programs from a command line. DOSBox is program for running (old) DOS programs writ

Re: Program chaining on Windows

2020-08-24 Thread Michael Torrie
On 8/24/20 1:30 AM, Rob Cliffe via Python-list wrote: >> Hmm. Python isn't really set up to make this sort of thing easy. > I guess this sentence pretty well answers my whole post. :-( After reading Eryk Sun's posts, it doesn't appear that Python is the issue here, but rather Windows does not make

Re: Program chaining on Windows

2020-08-24 Thread Eryk Sun
On 8/24/20, Rob Cliffe wrote: > > Are you suggesting something I could do in Python that would achieve my > aim of *replacing* one program by another No, it's not possible with the Windows API. Implementing POSIX exec would require extensive use of undocumented NT runtime library functions, syste

Re: Program chaining on Windows

2020-08-24 Thread Rob Cliffe via Python-list
On 24/08/2020 00:57, Chris Angelico wrote: On Mon, Aug 24, 2020 at 9:51 AM Rob Cliffe via Python-list wrote: Let me describe my actual use case. I am developing a large Python program (in Windows, working in DOS boxes) and I constantly want to modify it and re-run it. What I have been doing

Re: Program chaining on Windows

2020-08-24 Thread Rob Cliffe via Python-list
On 24/08/2020 00:08, Eryk Sun wrote: For Windows, we need to spawn, wait, and proxy the exit status. Sorry, I understand very little of this.  Here's where I get stuck:     (1) "*spawn*": I see that there are some os.spawn* functions.  I tried this:     # File X1.py     import os, sys    

Re: Program chaining on Windows

2020-08-24 Thread Chris Angelico
On Mon, Aug 24, 2020 at 5:30 PM Rob Cliffe wrote: > > On 24/08/2020 00:57, Chris Angelico wrote: > > 2) The same thing but entirely within Python. Instead of importing > > modules, manually load them and exec the source code. (No relation to > > the process-level exec - I'm talking about the exec

Re: Program chaining on Windows

2020-08-23 Thread Chris Angelico
On Mon, Aug 24, 2020 at 9:51 AM Rob Cliffe via Python-list wrote: > Let me describe my actual use case. I am developing a large Python > program (in Windows, working in DOS boxes) and I constantly want to > modify it and re-run it. What I have been doing is to make it respond > to a hotkey by ca

Re: Program chaining on Windows

2020-08-23 Thread Rob Cliffe via Python-list
Thanks for everyone who replied so far, it is appreciated.  (I don't particularly like asking for help and taking up other peoples' time, but I really ran out of ideas.) Chris, thanks for your explanation: With exec, the intention is to*replace* the current program, not to inv

Re: Program chaining on Windows

2020-08-23 Thread Eryk Sun
On 8/23/20, Chris Angelico wrote: > On Mon, Aug 24, 2020 at 7:40 AM dn via Python-list > >> As a 'general rule', isn't exec() something to be avoided? > > Nope, it's a very important tool. Not for every situation, of course, > but there are plenty of times when it's the right thing to do. In POSI

Re: Program chaining on Windows

2020-08-23 Thread Chris Angelico
On Mon, Aug 24, 2020 at 7:40 AM dn via Python-list wrote: > > On 24/08/2020 09:04, Chris Angelico wrote: > > On Mon, Aug 24, 2020 at 6:39 AM dn via Python-list > > wrote: > >> > >> On 23/08/2020 19:31, Rob Cliffe via Python-list wrote: > >>> On WIndows 10, running Python programs in a DOS box, I

Re: Program chaining on Windows

2020-08-23 Thread dn via Python-list
On 24/08/2020 09:04, Chris Angelico wrote: On Mon, Aug 24, 2020 at 6:39 AM dn via Python-list wrote: On 23/08/2020 19:31, Rob Cliffe via Python-list wrote: On WIndows 10, running Python programs in a DOS box, I would like one Python program to chain to another. I.e. the first program to be r

Re: Program chaining on Windows

2020-08-23 Thread Eryk Sun
On 8/23/20, Rob Cliffe via Python-list wrote: > > Am I missing something? Is there a way in Windows for one Python > program to "chain" to another (or indeed to any executable) without > waiting for the latter to finish? Windows does not implement anything equivalent to the POSIX exec family of

Re: Program chaining on Windows

2020-08-23 Thread Barry
> On 23 Aug 2020, at 20:58, Rob Cliffe via Python-list > wrote: > > On WIndows 10, running Python programs in a DOS box, I would like one Python > program to chain to another. I.e. the first program to be replaced by the > second (*not* waiting for the second to finish, as with e.g. os.sys

Re: Program chaining on Windows

2020-08-23 Thread Chris Angelico
On Mon, Aug 24, 2020 at 6:39 AM dn via Python-list wrote: > > On 23/08/2020 19:31, Rob Cliffe via Python-list wrote: > > On WIndows 10, running Python programs in a DOS box, I would like one > > Python program to chain to another. I.e. the first program to be > > replaced by the second (*not* wai

Re: Program chaining on Windows

2020-08-23 Thread dn via Python-list
On 23/08/2020 19:31, Rob Cliffe via Python-list wrote: On WIndows 10, running Python programs in a DOS box, I would like one Python program to chain to another.  I.e. the first program to be replaced by the second (*not* waiting for the second to finish, as with e.g. os.system).  This doesn't s

Program chaining on Windows

2020-08-23 Thread Rob Cliffe via Python-list
On WIndows 10, running Python programs in a DOS box, I would like one Python program to chain to another.  I.e. the first program to be replaced by the second (*not* waiting for the second to finish, as with e.g. os.system).  This doesn't seem a lot to ask, but so far I have been unable to so t