Y
Y
Yuri2019-10-11 15:07:41
Python
Yuri, 2019-10-11 15:07:41

Python subprocess library error?

I'm trying to run an external BGinfo program, but it gives an error ( Below is the full error code )

Traceback (most recent call last):
File "main.py", line 8, in
gpl = subprocess.Popen (["Bginfo64.exe config.bgi /timer:00 /silent /nolicprompt"] , stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
File "C:\Users\test\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
restore_signals , start_new_session)
File "C:\Users\test\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The specified file cannot be found

The file is definitely there, I checked the paths 300 times. and the same error when starting another program, although everything worked before. what is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
o5a, 2019-10-11
@o5a

The 1st parameter of Popen must be a list of arguments, not a string with all of them, or don't use shell=True. Those. in this case apparently

["Bginfo64.exe", "config.bgi", "/timer:00", "/silent", "/nolicprompt"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question