I'm trying to run the following code (it i simplified a bit):
def RunTests(self):
from threading import Thread
import signal
global keep_running
keep_running = True
signal.signal( signal.SIGINT, stop_running )
for i in range(0, NumThreads):
thread = Thread(target = foo)
...
I'm struggling to deal with my plot margins in matplotlib. I've used the code below to produce my chart:
plt.imshow(g)
c = plt.colorbar()
c.set_label("Number of Slabs")
plt.savefig("OutputToUse.png")
However, I get an output figure with lots of white space on either side of the plot. I've searched google and read the matplotlib docume...
Does anyone know this?
ncm-xen1:/usr/lib64/python2.6/site-packages # ls libvirt*
libvirtmod.so libvirt.py libvirt.pyc libvirt$py.class
ncm-xen1:/opt/jython2.5.1 # ./jython
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_14
Type "help", "copyright", ...
Hi,
I have a python project, which uses qt(UI) for user input and then creates the pdf using latex.
I want to make full package of my whole projects in some form of exe.
I came to know about pyinstaller, pyexe and cx_frezer.
So which one should I pick up first.
My exe should run in windows 98, xp, vista and linux.
So how does MIketex( ...
Django: If I added new tables to database, how can I query them?
Do I need to create the relevant models first? Or django creates it by itself?
More specifically, I installed another django app, it created several database tables in database, and now I want to get some specific data from them? What are the correct approaches? Thank you...
I want to have some constants in a Django Projects. For example, let's say a constant called MIN_TIME_TEST.
I would like to be able to access this constant in two places: from within my Python code, and from within any Templates.
What's the best way to go about doing this?
EDIT:
To clarify, I know about Template Context Processors and...
This might be a simple one. Assume I have a program that uses argparse to process command line arguments/options. The following will print the 'help' message:
./myprogram -h
or:
./myprogram --help
But, if I run the script without any arguments whatsoever, it doesn't do anything. What I want it to do is to display the usage message ...
I'm using the Freebase Python library. It creates a log before executing:
self.log = logging.getLogger("freebase")
Where is this log in the file system? It's not in the executing directory or tmp.
...
What is the __main__.py file for, what sort of code should I put into it and when should I have one at all? :)
...
Possible Duplicate:
What is the equivalent of the C# using block in IronPython?
I'm writing some IronPython using some disposable .NET objects, and wondering whether there is a nice "pythonic" way of doing this. Currently I have a bunch of finally statements (and I suppose there should be checks for None in each of them too - ...
I've got a Python application which is daemonized and running on a server 24/7. I'd like to be able to give an incredibly simple web interface so that I can monitor the changing values of a few variables within the program.
I'm using Tornado, and I'm up and running with the simple 'Hello, world' that you can find on the Tornado homepag...
Hello guys, thank your for reading.
Well, I have a single python process which is using a serial port (unique resource) which is manage using an instance of a (A=Class A). Exist two different thread initialized using B=Class_B() and C=Class_C(), which are constantly using the serial port resource through the objected already created cal...
HI, guys. I want to develop a window or frame for the bash shell program.
Even after trials with the code of the link given by Bryan (thank you so much!!), it still does not work.
Basically, I use the code sample put by Anurag Uniyal. However, I have to deal with several processes (so one window for one subprocess call). I do not know ...
I'm trying to include some data files in a python package using the setuptools package_data option. I'm then accessing the files with pkg_resources. This works perfectly when the python .egg file is installed as-is (i.e. still zipped). But when the egg file is unzipped during installation, the data files are not installed.
In other word...
I have an SCons project set up as follows:
proj/
SConstruct
src/
c/
h/
app1/SConscript
app2/SConscript
...
All source/header files for each application are located in src/c and src/h.
At first step I created a SConstruct in app1 which use the Repository function.
...
src=Split("main.c ...
Hello everyone,
I have a problem when I try to convert a XML file in a PDF file, here I’m going to explain briefly how I try to generate a PDF file.
We suppose I get the information from a database, then the code source is the following:
import pyodbc,time,os,shutil,types
import cStringIO
import ho.pisa as pisa
import urllib
def HTML...
Hello,
I've been trying to build a simple GAE app and to be able to manipulate the position of the text on the screen. I asked the same question on several forums; so far with no solution. I apologize if my question has not been clear.
Now I thought of achieving the same functionality with a grid, like a spreadsheet. Do you know how I...
I'd like to use both parse time and runtime interpolation for values of a configobj configuration file. The easiest way to do simple string interpolation in Python is "%(foo)s" % somedict. Unfortunately configobj uses the same interpolation mechanism and I have not yet found a way to escape it. Ideally my value would look like:
othervar...
What's the best way to handle lots of connections at once in python? The first way I think of is threading, which works but at 10MB of RAM per thread that's rather expensive.
So what other ways are there to handle lots of connections at once ?
The only problem I see without using threads is that using the socket.recv() waits for data f...
Can anyone help me, ?
...