I'm trying to build a function that would allow to repeat this (it prevents the console from opening in windows):
 if platform.system() == 'Windows':
        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        subprocess.call(['myprogram.exe', '-P', arg], 
                       stdout=someFile, startupinfo=startupinfo)
    else:
        subprocess.call(['myprogram.exe', '-P', arg], stdout=someFile)
Therefore I defined the following function:
def noWinConsole(program):
    if platform.system() == 'Windows':
        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        subprocess.call(program, startupinfo=startupinfo)
    else:
        subprocess.call(program)
But when I call it like this noWinConsole(['myprogram.exe', '-P', arg], stdout=someFile) , I get an error because of stdout=somefile:
TypeError: noWinConsole() got an unexpected keyword argument 'stdout'
How can I fix this ?
 
     
     
    