-2

Hello i'm been having some trouble with run a exe file on python. I'm using a Raspberry Pi and have not been able to find an answer that works. I've tried to use subprocess

import subprocess
subprocess.Popen("/home/pi/Desktop/file.exe")

only to get [Errno 8] Exec format error. I get the same thing with subprocess.call.

I tried to use os

import os
os.system("/home/pi/Desktop/file.exe")

I get no errors there but nothing happens.

I know the exe file works when I click on it, I know that the file path is correct. Is there anyway I could run this exe with my python program.

John
  • 1
  • 2
  • How does the raspberry Pi able to open .exe files? does it open it with Wine or another emulator? – Tadhg McDonald-Jensen May 13 '16 at 16:15
  • Does it work on your Raspberry Pi (perhaps, from GUI) or on some other computer? – WGH May 13 '16 at 16:21
  • 2
    did you realize that .exe file are windows executable and not valid on Linux? – JrBenito May 13 '16 at 16:25
  • What exe is that? Unless it's actually a managed-only .NET application there's no way it can run on Raspbian. – Matteo Italia May 13 '16 at 17:01
  • Okay so I just realized its not an exe. It is a desktop configuration file. I made an exe open with the desktop file. However when I try this with subprocess with the new extension I get exec format error. with os.system I don't see anything happening – John May 13 '16 at 18:23
  • Try to open your file through `xdg-open` (i.e. `xdg-open /home/pi/Desktop/file.exe`) and see what happens. – WGH May 14 '16 at 10:23

1 Answers1

0

Okay, .exe files are windows executables. They are not compiled for Linux (Raspian) at all. however you can find the extension of your file by opening a terminal window, navigate to the desktop with cd ~/Desktop/ Then run ls -la to list the folder contents.

On the other hand, if you are meaning a Python file to run then it will have the extension .py. To run these open up your terminal and navigate to your Desktop again using cd ~/Desktop/ and run it with python file.py

Harvey
  • 1,320
  • 3
  • 13
  • 33