Python Forum
C:\Windows\System32\appwiz.cpl is not a valid Win32 application
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C:\Windows\System32\appwiz.cpl is not a valid Win32 application
#1
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
Reply
#2
The error message is clear.
Windows OS cannot find the application
Reply
#3
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
Reply
#4
try
subprocess.run(['appwiz.cpl'], shell=Tue)
or

subprocess.run(['contol', 'appwiz.cpl'], shell=Tue)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
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.
Reply
#6
I was not able to successfully run it without shell=True. I get the same error as OP
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
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"])
Reply
#8
Buran's code worked for me:
Quote:import subprocess

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

Thank you!
Reply
#9
(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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Script getting reindexing only valid error cubangt 1 885 Dec-07-2023, 04:06 PM
Last Post: cubangt
Question Use function, retry until valid Ashcora 8 1,460 Jan-06-2023, 10:14 AM
Last Post: Ashcora
  checking for valid hexadecimal digits Skaperen 3 6,361 Sep-02-2021, 07:22 AM
Last Post: buran
  Python library for win32 console commands eldiener 3 3,447 Aug-24-2021, 10:28 PM
Last Post: bowlofred
  Win32\ping.exe windows pops up -very annoying... tester_V 9 3,203 Aug-12-2021, 06:54 AM
Last Post: tester_V
  How to send data from a python application to an external application aditya_rajiv 1 2,172 Jul-26-2021, 06:00 AM
Last Post: ndc85430
  Launch Windows Application OEMS1 0 2,116 Mar-26-2021, 07:42 PM
Last Post: OEMS1
Exclamation binwalk Win32 compile hackstunt 2 3,781 Feb-24-2021, 05:14 PM
Last Post: nilamo
  pyarrow throws oserror winerror 193 1 is not a valid win32 application aupres 2 3,770 Oct-21-2020, 01:04 AM
Last Post: aupres
  Limiting valid values for a variable in a class WJSwan 5 3,592 Jul-06-2020, 07:17 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020