Python Forum
OSError occurs in Linux. - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: OSError occurs in Linux. (/thread-41825.html)



OSError occurs in Linux. - anna17 - Mar-23-2024

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()


RE: OSError occurs in Linux. - deanhystad - Mar-23-2024

Please post the entire error message, including traceback


RE: OSError occurs in Linux. - snippsat - Mar-23-2024

(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.