简体   繁体   中英

(Python) “auto input in cmd”

i'm trying to make an auto compiler for a file using pyinstaller. here is the auto compiler code:

import os
os.system('pyinstaller Main.py')
os.remove('Main.spec')

but then the cmd asks: "The output directory: " C:\\ Users... " and all it's contents will be removed! Continue? y/n " then the user must press y to delete the unwanted file. is there any way to "auto input " the key Y and continue deleting unwanted files? (The pyinstaller creates the "mainfile".specs, build folder ( unwanted) and dist folder ( program compiled into it)) srry for bad english

It appears pyinstaller has an option -y or --noconfirm to avoid such an interactive question. Have you tried that?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM