I have a web2py application that is running the program "winexe" function through python subprocess.Popen. The problem arises when it is launched winexe: starts correctly but does not exit. Web2py runs on apache using mod_wsgi and with user www-data.
Code:
import os
import pwd
import base64
p = subprocess.Popen(['winexe', '--system', '-U user%password', '//ip_client', '"cmd /C wmic os get osarchitecture"'], stdout = subprocess.PIPE)
output = p.communicate()[0]
print output
if I run the same command from the command line with winexe working properly
winexe -U user%pass //ip_client "cmd /C wmic os get osarchitecture"
OSArchitecture
64 bit
Can you help me? Thanks