Python Forum
C:\Windows\System32\appwiz.cpl is not a valid Win32 application - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: C:\Windows\System32\appwiz.cpl is not a valid Win32 application (/thread-24744.html)



C:\Windows\System32\appwiz.cpl is not a valid Win32 application - Marceepoo - Mar-02-2020

proc = subprocess.Popen(r"C:\Windows\System32\appwiz.cpl")
generates the following error:
OSError: [WinError 193] %1 is not a valid Win32 application

Any suggestions about how to fix this, and/or where to learn more would be appreciated.

Thanks,
Marceepoo


RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - Larz60+ - Mar-02-2020

The error message is clear.
Windows OS cannot find the application


RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - Marceepoo - Mar-06-2020

Thank you, Larz60+, for responding.

I do not understand why Windows OS cannot find the application when I run my python command:
proc = subprocess.Popen(r"C:\Windows\System32\appwiz.cpl")
If I open a "Command Prompt" window on my Windows 10 Professional system, by clicking the icon that runs:
Quote:"C:\WINDOWS\system32\cmd.exe"

... and I run the command line "appwiz.cpl":
Windows runs the command successfully, and
The command effectively opens a program window entitled: "Control Panel\All Control Panel Items\Programs and Features"

What do I need to do when I run subprocess so that the Windows OS can find the application
Quote:"C:\WINDOWS\system32\cmd.exe"
?

Thank you again for taking the time to reply and help me. Much appreciated.

Marc


RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - buran - Mar-06-2020

try
subprocess.run(['appwiz.cpl'], shell=Tue)
or

subprocess.run(['contol', 'appwiz.cpl'], shell=Tue)



RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - snippsat - Mar-06-2020

Set shell=True when a call command that's not in a list.
import subprocess

proc = subprocess.Popen(r"C:\Windows\System32\appwiz.cpl", shell=True)
Alternative not using shell=True,look upon as safer way.
import subprocess

proc = subprocess.run(['control', "appwiz.cpl"])
Edit:did not see post from @buran,as i did a test of this when posted.


RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - buran - Mar-06-2020

I was not able to successfully run it without shell=True. I get the same error as OP


RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - snippsat - Mar-06-2020

buran Wrote:I was not able to successfully run it without shell=True. I get the same error as OP
This work fine for me Python 3.7 Win-10,tested on couple of Pc's.
import subprocess

proc = subprocess.run(['control', "appwiz.cpl"])



RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - Marceepoo - Mar-15-2020

Buran's code worked for me:
Quote:import subprocess

proc = subprocess.run(['control', "appwiz.cpl"])

Thank you!


RE: C:\Windows\System32\appwiz.cpl is not a valid Win32 application - buran - Mar-15-2020

(Mar-15-2020, 12:21 AM)Marceepoo Wrote: Buran's code worked for me
It was @snippsat's code, but good that your problem is solved.