python - Trouble passing arguments into os.system() -




i want run python script 5 times. output each run image, , want 5 images saved @ end. using os.system() command, , end following error:

typeerror: system() takes @ 1 argument (3 given) 

here code:

import os = 1      while < 6:         run = os.system ('python main.py', 'input laska.png', 'output laska_save' + str(i) + '.png')         = + 1 

not sure problem here might be. want output argument laska_save1, laske_save2 ... laska_save5. increment happens 5, once everytime after called script runs.

any guidance appreciated.

you should call 1 string follows:

os.system('python main.py input laska.png output laska_save{}.png'.format(i)) 

the os.system documentation says take string argument, must create full string command before passing function.





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -