How to open a .exe file? [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
May someone please tell me how to set up code in Python that will allow me to open an .exe file?
The file location is:
C:\Users\Public\Videos\Sample Videos\New Folder\ksp-win-0-21-1\KSP_win cosmetic mods
and the file is called:
KSP.exe
Shorter code would be preferred, but it does not matter that much.
I don't know if it would make a difference, but I am using a Windows 7 computer.

import subprocess
subprocess.call(["C:\Users\Public\Videos\Sample Videos\New Folder\ksp-win-0-21-1\KSP_win cosmetic mods\KSP.exe"])

Another way to run an exe is through the os.system command:
import os
os.system("Path\\to\\file.exe")
The os.system command will allow you to run commands as if they were in your command prompt.

Related

Run Python file on spare desktop [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 15 hours ago.
Improve this question
Good day friends.
I've developed some discord bots on python I'd like to have running continuously. I own a spare hp z600 desktop which I would like to use for this purpose.
What would be the best way to have these running on the background?
I've tried simply running it on vs code but apparently it will put the terminal to sleep after a while.

Import code works when typed into Shell. but not when running py.script? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I'm having some problem understanding this.
The imported code works successfully when I run the command directly in shell, but it fails when I run the identical code in a .py file
I tried downgrading to 3.5 after getting the same error in 3.7
You've called your local script "goodreads", so Python tries to import that rather than the library. Name your script something else.

Converting .pyw to .exe [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
If I use py2exe to convert a .pyw to a .exe, will it run with a console open? I have some Python files I want to run in the background that I'm going to need to have on computers that don't have Python installed.
Use the windows parameter (instead of console) in your py2exe configuration, and no terminal window will appear.
Make a py2exe exe run without a console?

Is there a way to execute a python script inside a vb program [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have tried to search for tutorials nothing exists is it even possible if yes how.
Use the Shell function to execute "python.exe yourscript.py". Note that this assumes python.exe is in your PATH. Otherwise, use the full path to python, usually c:\Python27

How can i invoke gdb using python to run a module [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a requirement to run a 'C'-module in gdb but this gdb should be involked by python script.
I think the best way to do this is to use subprocess:
subprocess.Popen(['gdb', 'arg1', 'arg2', 'etc'])
If you are using Python 2.x and you only want to record the output, you can use commands, but it is deprecated since 2.6.
You might want to check Invoke and control GDB from Python
Hacky solution as always: os.system.
os.system("gdb arg1 arg2 etc")

Categories

Resources