How to run a file from the body of a program? [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
What is the python command to run a py-file.?
For example, in my index.py file how would i launch start.py.

In index.py, simply use subprocess:
import subprocess
subprocess.check_output(["python", "start.py"])

Related

How to take screenshot using d3dshot? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
i just found d3dshot module for taking screenshot
but i can't find anything in google about it
i heard that it is very fast is it true?
d3dshot.CaptureOutputs
d3dshot.capture_output
d3dshot.capture_outputs
d3dshot.display
what should i do?

I can't even create file on the VS Code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 days ago.
Improve this question
Unable to write file 'c:\Users\himan.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\launcher.vscode\launch.json' (Error: Unable to create folder 'c:\Users\himan.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\launcher' that already exists but is not a directory)
I tried everything even reinstalling VS Code twice.

How to debug with exec in Python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 months ago.
Improve this question
I have a file with the code and I want to run it using exec(file.read()). However when I put the breakpoint in that file then it's not reached. How can I run this file and make the breakpoint work?
That's not the usual way of running Python files, but if you have a breakpoint() in the middle of the file, it should work.
I think you actually want to import the file or run it directly.

How do I open an application using Python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
How do I open an app like Minecraft using os or subprocess? I went through a few videos and none of them worked. Do I just use the name of the app or its location?
For this example, you could use:
subprocess.run(r'"C:\path_to_minecraft\minecraft"',shell=True)
Or if you have Windows shortcuts you add the .lnk extension in the call:
subprocess.run(r'"C:\path_to_minecraft\minecraft.lnk"',shell=True)
this works.
import os
os.system("your app.exe")

Can you use python to load a quick ruby script? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I was curious if you could use python to load a quick ruby script? then continue with python.
The simplest way is to use call from subprocess module:
from subprocess import call
call(['ruby', 'quick_script.rb', 'some_parameter'])
Ruby should be available from the path variable.

Categories