What's the easieest way to create a sorted table view in gtk? I'm not sure if that's the right term, but you know the one:
Is there a built-in widget for this? If not, how would I go about making those columns that look slightly different, click to change sorting, etc. Note I don't need multi-column sorting at the moment.
...
I have a list and I want to remove from it the items that don't appear in another list. I've tried the following:
for w in common:
for i in range(1,n):
if not w in words[i]:
common.remove(w)
However, this fails to remove some of the items. Adding print statements for w in common:
for i in r...
By default when I run a freshen scenario, which contains an undefined given/when/then clause, that test is simply marked as undefined. No further helpful message as to what actually isn't defined is given. Is there a way to change this behavior to get more information what exactly was undefined?
...
I think in Python 3 I'll be able to do:
first, *rest = l
which is exactly what I want, but I'm using 2.6. For now I'm doing:
first = l[0]
rest = l[1:]
This is fine, but I was just wondering if there's something more elegant.
...
Hi,
I followed this link here to try and set up emacs for python dev on windows. Although everything seems fine, pyflakes is creating problems and not giving me the syntax checking. Everytime I open a '.py' file, I get the error
"Failed to launch syntax check process 'pyflakes' with args 'foo.py': searching for program: No such file or ...
I am trying to construct a little GUI that has a plot which updates every time a new data sample is read. I would prefer not to run it with a timer, since the data will be arriving at differing intervals. Instead, I'm trying to make an implementation using signals, where the data collection function will emit a signal when data is read...
import random
secret = random.randint (1,99)
guess = 0
tries = 0
print ("AHOY! I'm the Dread Pirate Roberts, and I have a secret!")
print ("It is a number from 1 to 99. I'll give you 6 tries. ")
while guess != secret and tries < 6:
guess = input ("What's yer guess? ")
if guess < secret:
print ("Too low, ye scurvy dog")...
Hi.
See the pagination on the app gallery? It has page numbers and a 'start' parameter which increases with the page number. Presumably this app was made on GAE. If so, how did they do this type of pagination? ATM I'm using cursors but passing them around in URLs is as ugly as hell.
...
What is the correct way to validate an xmpp jid? The syntax is described here:, but I don't really understand it. Also, it seems pretty complicated, so using a library to do it would seem like a good idea.
I'm currently using xmpppy, but I can't seem to find how to validate a jid with it. Any help appreciated!
...
I'm trying to parse HTML and automatically change the font of any foreign characters, and I'm having some issues. There are a few different hackish ways I'm trying to accomplish this, but none work really well, and I'm wondering if anyone has any ideas. Is there any easy way with python to match all the foreign characters (specifically, ...
After a fresh installation of my Windows dev machine, I installed Python 2.7.
Quickly I learnt that this was a mistake as many of the packages I use only work on Python 2.6. So I installed 2.6 also and now I have both installations.
How can I make everything work with Python 2.6 instead of Python 2.7?
Every time I install a package it ...
I want to run a cpu intensive program in Python across multiple cores and am trying to figure out how to write C extensions to do this. Are there any code samples or tutorials on this?
...
Deferreds are a great way to do asynchronous processing in Twisted. However, they, like the name implies, are for deferred computations, which only run and terminate once, firing the callbacks once. What if I have a repeated computation, like a button being clicked? Is there any Deferred-like object that can fire repeatedly, calling all ...
I have a view in my Django application that automatically creates an image using the PIL, stores it in the Nginx media server, and returns a html template with a img tag pointing to it's url.
This works fine, but I notice an issue. For every 5 times I access this view, in 1 of them the image doesn't render.
I did some investigation and...
This is what I'm trying to do. Have one main form with all the data and have several dialogs, from which the data will be added to the main form.
After all the data is in the main form I will submit the form. But the problem is it won't save the values of the data in the dialogs when I copy the html to the main form. It won't put the va...
EDIT-4
I've gotten my sitecustomize.py to execute, but it tosses up an error. Here's the code for it.
The error is:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
RuntimeError: maximum recursion depth exceeded while calling a Python object
I'm not terribly advanced with Python yet, so I figured I'd comment out only the l...
I have an executable (converted to exe from python using py2exe) that outputs lists of numbers that could be from 0-50K lines long or a little bit more.
While developing, I just saved them to a TXT file using simple f.write.
The person wants to print this output on paper! (don't ask why lol)
So, I'm wondering if I can output it to some...
Hi, I need a better way to prevent that normal users execute my python script. I'm doing something like that:
if __name__ == '__main__':
if os.getenv('USER') == 'root':
addUser = addUser()
else:
print 'Only root can run that!'
It's working, but it's pretty ugly!
My script is about user management in a Debian sy...
I'm still relatively new to Python, so if this is an obvious question, I apologize.
My question is in regard to the urllib2 library, and it's urlopen function. Currently I'm using this to load a large amount of pages from another server (they are all on the same remote host) but the script is killed every now and then by a timeout error...
i am using rpy2-2.0.7 (i need this to work with windows 7, and compiling the binaries for the newer rpy2 versions is a mess) to push a two-column dataframe into r, create a few layers in ggplot2, and output the image into a <.png>.
i have wasted countless hours fidgeting around with the syntax; i did manage to output the files i neede...