Код: Выделить всё
def load_mydata(self, file):
_output = file.with_suffix(".csv")
# delete output file if it already exists
_output.unlink(missing_ok=True)
_args = 'MyDataConverter.exe input="{}" output="{}"'.format(file, _output)
print(_args)
subprocess.run(_args)
print('tada')
Код: Выделить всё
Press any key to exit.
Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
at System.Console.ReadKey(Boolean intercept)
at Converter.Program.ProgramExit(TextWriter output, Int32 returnValue)
at Converter.Program.Main(String[] args)
Код: Выделить всё
subprocess.run(_args, input=b'\n')
Код: Выделить всё
with open('MyResponsefile.txt', 'r') as fIn:
subprocess.run(_args, stdin=fIn)
Я даже пробовал
Код: Выделить всё
try:
subprocess.run(_args)
except:
pass
Подробнее здесь: https://stackoverflow.com/questions/793 ... o-complete