Hello.

The bottom line is, there is a command to enable CGI in IIS:

Start / w pkgmgr / iu: IIS-WebServerRole; IIS-WebServer; IIS-ap-HHppFeatures; IIS-StaticContent; IIS-DefaultDocument; IIS-Directory Browsing; IIS-HttpErrors; IIS-Security; IIS-RequestFiltering; IIS-HttpCompressionStatic; IIS-WebServerManagementTools; IIS-ManagementConsole; WAS-WindowsActivationService; WAS-ProcessModel; WAS-NetFxEnvironment; WAS-ConfigurationAPI; IIS-CGI

( source )

I need to execute it in a python script, my code is:

subprocess.call(command, shell=True, stdout=DEVNULL, stderr=LOG_FILE) 

When executing the script (under the admin) pops up a window

Operation failed, error 0x8007000B, An attempt was made to load a program that has the wrong format.

at the same time, if you just run the command - it works.

    1 answer 1

    Do I understand correctly that Start is an executable file? If, yes then try to specify the full path to it.


    Are you sure you want to invoke the command via subprocess.call ? If this is a script and not a service with complex logic, it will probably be easier to use os.system(command) in this case.