Processlist
How do I get a process list of all running processes from Python, on Unix, containing then name of the command/process and process id, so I can filter and kill processes. ...
How do I get a process list of all running processes from Python, on Unix, containing then name of the command/process and process id, so I can filter and kill processes. ...
I'm implementig a Composite pattern in this way: 1) the "abstract" component is: class Component(object): """Basic Component Abstraction""" def __init__(self, *args, **kw): raise NotImplementedError("must be subclassed") def status(self): """Base Abstract method""" raise NotImplementedError("must be implemented") 2) a le...
I've set up TeamCity on a Linux (Ubuntu) box and would like to use it for some of Python/Django projects. The problem is that I don't really see what to do next - I tried searching for a Python specific build agent for TeamCity but without much of the success. How can I manage that? ...
In a framework like Django or Pylons you can set up function to handle form submissions. If your form involves a dropdown menu (i.e. a select tag) populated with objects from a database you can set the values equal to the primary key for the record like: <select> <option value="1">Volvo</option> <option value="2">Saab</option> <o...
Possible Duplicate: How many Python classes should I put in one file? Coming from a C++ background I've grown accustomed to organizing my classes such that, for the most part, there's a 1:1 ratio between classes and files. By making it so that a single file contains a single class I find the code more navigable. As I introduce...
I've been playing with pyglet. It's very nice. However, if I run my code, which is in an executable file (call it game.py) prefixed with the usual #!/usr/bin/env python by doing ./game.py then it's a bit clunky. But if I run it with python -O ./game.py or PYTHONOPTIMIZE=1 ./game.py then its super-smooth. I'm don't care m...
My Python utility script contains UNIX system calls such as status, output = commands.getstatusoutput("ls -ltr") print "Output: ", output print "Status: ", status Which work fine and print the output to the console but as soon as I run Maven from the same script, status, output = commands.getstatusoutput("mvn clean install -s./../.....
Hello, I have my web page in python, i am able to get the ip address of the user, who will be accessing our web page, we want to get the mac address of the user's PC, is it possible in python, we are using linux PC, we want to get it on linux. ...
I am trying to SFTP from Python running on windows and installed Paramiko as was recommended here. Unfortunately, it asks for Crypto.Util.randpool so I need to install the Crypto package. I found RPMS for Linux, but can't find anything or source code for windows. The readme for Paramiko states: pycrypto compiled for Win32 can be downloa...
My machine has two audio inputs: a mic in that I use for gaming, and a line in that I use for guitar. When using one it's important that the other be muted to remove hiss/static, so I was hoping to write a small script that would toggle which one was muted (it's fairly inconvenient to click through the tray icon, switch to my input devic...
What event system for Python do you use? I'm already aware of pydispatcher, but I was wondering what else can be found, or is commonly used? I'm not interested in event managers that are part of large frameworks, I'd rather use a small bare-bones solution that I can easily extend. ...
I have gdata library install on my ArchLinux, and a simple application which imports atom library at the beginning, when I run gapp engine and access that web app, $ python2.5 ./dev_appserver.py ~/myapp It throws exception 'No module named atom'. But when I run 'import atom' in Python2.5 interactive mode, it works well. How can I i...
I'm writing a facebook desktop application for the first time using the PyFacebook api. Up until now, since I've been experimenting, I just passed the secret key along with the api key to the Facebook constructor like so: import facebook fb = facebook.Facebook("my_api_key", "my_secret_key") and then logged in (fb.login() opens a brow...
How can I check what version of the Python Interpreter is interpretting my script? ...
I have a simple web.py program to load data. In the server I don't want to install apache or any webserver. I try to put it as a background service with http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ And subclassing: (from http://www.jejik.com/files/examples/daemon.py) class Daemon: def start(self): ...
I am doing an application which will use multiple sqlite3 databases, prepopuldated with data from an external application. Each database will have the exact same tables, but with different data. I want to be able to switch between these databases according to user input. What is the most elegant way to do that in TurboGears 2? ...
So I have an Arduino connected to my Windows XP computer. It's just running a loop, sending a value over the serial port back to the computer every 100ms. I want to make a Python script that will read from the serial port only every few seconds, so I want it to just see the last thing sent from the Arduino. How do you do this in Pys...
Currently I am working on a piece of software, which is currently written 100% in Objective-C using the iPhone 3.0 SDK. I have come to a cross roads where I need to do quite a bit or string concatenation, more specifically, NSString concatenation and so far I have been doing it like this: Objective-C string concatenation: NSString *re...
Hi all...First python script and I'm getting an error I can't seem to get around using a config file. The first part of the script takes user input and puts that into a mysql database with no problem..Then I get to the filesystem work and things go a bit pear shaped..I can get it to work without using the config file options but I'd like...
Hi If one wants to develop a user interface in Python, which one to go for: TkInter or PyQt. I just started with TkInter and I was able to get some simple UIs going with elementary widgets like label, button, text box etc. Just curious to know how good PyQt would be compared to TkInter? cheers ...