[Tutor] Does python change subprocess based on whether it is run in the interactive shell or not
Roel Schroeven
roel at roelschroeven.net
Sat Oct 29 14:38:50 EDT 2022
Mats Wichmann schreef op 29/10/2022 om 20:02:
> Pretty messy, isn't it? These two snips - they're not adjacent in the doc:
>
> > If args is a string, the interpretation is platform-dependent and
> described below.
>
> > On Windows, if args is a sequence, it will be converted to a string
> in a manner described in Converting an argument sequence to a string on
> Windows. This is because the underlying CreateProcess() operates on strings.
>
> So in the Windows case, it always wants a string underneath, and since
> that's what was passed by the OP it doesn't seem likely that's "the"
> problem.
Oh, right, I was wrong. I tried before but I must have a mistake. I just
tried again and indeed, passing a string works indeed on Windows even
without shell=True.
--
"Cheer up," they said, "things could be worse." So I cheered up, and
sure enough, things got worse.
-- Paraphrased from James C. Hagerty
More information about the Tutor
mailing list