subprocess call question

MRAB python at mrabarnett.plus.com
Thu Dec 14 13:00:19 EST 2017


On 2017-12-14 17:35, Wanderer wrote:
> This dos batch files works on windows 7
> 
> "C:\Program Files (x86)\DOOM 3\qoom3.exe" +set fs_game_base darkmod +set fs_game training_mission
> 
> but this python subprocess.call doesn't
> 
> subprocess.call(['C:/Program Files (x86)/DOOM 3/qoom3.exe', '+set fs_game_base darkmod', '+set fs_game training_mission'])
> 
> qoom3.exe starts but it gives the warnings "unknown commands set fs_game_base darkmod and set fs_game training_mission"
> 
> Why?
> 
Each of the strings in the list will be quoted, so the command line 
you're actually giving it is:

"C:/Program Files (x86)/DOOM 3/qoom3.exe" "+set fs_game_base darkmod" 
"+set fs_game training_mission"

hence it's complaining that there's no command "+set fs_game_base darkmod".

The call should be:

subprocess.call(['C:/Program Files (x86)/DOOM 3/qoom3.exe', '+set', 
'fs_game_base', 'darkmod', '+set', 'fs_game', 'training_mission'])



More information about the Python-list mailing list