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")
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
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.
Improve this question
I'm trying to install Jython 2.7 to use with RobotFramework. I've downloaded all three of the jar files from http://www.jython.org/downloads.html and yet none of them actually install Jython!
I've tried running them from the command line (where a java server is opened) and just opening with java which does nothing. What am I doing wrong? I don't think that the downloads would be hosted if they didn't work.. Could it be that my other installs are affecting it?
Edit: My end goal is to use Jython with RobotFramework to run my test cases in Java
Thanks in advance
Those jars are jython. Run java -jar <jarfile> and you'll be in the jython command line. There is nothing else to install.
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.
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
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 8 years ago.
Improve this question
I want to run 'arp or config' commands on apache using python
from mod_python import apache
I have tested codes but the output is empty or command not found.
I think that i need to give permission to apache to access this command.
Use absolute commands:
/sbin/arp
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
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
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Improve this question
What is the python alternative to Thor for building self-documenting command line utilities?
UPDATE: The click is the closest equivalent of Thor for python, see http://click.pocoo.org/
Python offers natively (via standard library) two packages to create auto-documenting interfaces for command line tools: optparse and argparse.
The docs says that optparse is deprecated and argparse replaces it, maintaining some backward compatibility where possible. Though, argparse is not so easy to use and 3rd-party libraries have been created.
Have a look at docopt and the video about it. cliff is another possibility.
To write line-oriented command interpreters you can find useful the Python cmd module.
I finally want to point out that docopt and cliff are not the Python alternative/s as you asked, but just the couple I found.
Not sure that this is exactly what you want, but imho it is Sphinx + python docstring + argparse.