Python Forum

Full Version: OSError occurs in Linux.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.
OSError occurs in Linux.

In Linux, OSError occurs.
What bug occurs in Linux in the code below?
Please Help me.

import subprocess
import os
import sys

exePath = “C:\subpro.exe” #<==This(subpro.exe) is an EXE developed in C#.
argument = “Apple”

process = subprocess.Popen([exePath, argument], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE);
stdout, stderr = process.communicate();
if process.returncode == 0:
print(“succeed, returned” + stdout.decode(“CP949”))
else:
print(“returned” + stdout.decode(“CP949”))
print(“failed, error” + str(process.returncode) + stderr.decode(“CP949”))
process.stdin.close();
if process.stderr is not None:
process.stderr.close()
process.wait()
Please post the entire error message, including traceback
(Mar-23-2024, 08:25 PM)anna17 Wrote: [ -> ]In Linux, OSError occurs.
What bug occurs in Linux in the code below?
Code will not work on Linux,like C:\subpro.exe is a Path that only work on Windows.
Path in Linux dos not have drive letters,eg like this /path/to/subpro
subpro.exe is an executable developed in C# for Windows.
Linux cannot natively run Windows executables.
Also all quotation marks are wrong,is a Unicode Character.