python

Is there a stable integration procedure/pluggin for Django 1.1 and Google app engine?

What is the best procedure/plugging to use to integrate django and google app engine? I have read many articles in the internet and seen videos on how to go round this. Am still left wondering which is the best procedure to use. Is there an official procedure documented in django or google app engine. Examples and site references will ...

Creating GUI with Python in Linux

Quick question. I'm using Linux and I want to try making GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is. Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is there any IDE that allows you to create GU...

How to call super() in Python 3.0?

Hi all, I have the strangest error I have seen for a while in Python (version 3.0). Changing the signature of the function affects whether super() works, despite the fact that it takes no arguments. Can you explain why this occurs? Thanks, Chris >>> class tmp: ... def __new__(*args): ... super() ... >>> tmp() Traceb...

How do I line up text from python into columns in my terminal?

I'm printing out some values from a script in my terminal window like this: for i in items: print "Name: %s Price: %d" % (i.name, i.price) How do I make these line up into columns? ...

file system performance testing

I am writing a python script that will perform performance test in linux file system. so besides deadlocks, race conditions and time takes to perform an action (delete, read, write and create) what other variables/parameters should the test contain? ...

Display jpg images in python

I am creating a simple tool to add album cover images to mp3 files in python. So far I am just working on sending a request to amazon with artist and album title, and get the resulting list, as well as finding the actual images for each result. What I want to do is to display a simple frame with a button/link for each image, and a skip/c...

sum of two numbers coming from the command line

Hi, I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python): import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum ...

Detecting case mismatch on filename in Windows (preferably using python)?

Hi, I have some xml-configuration files that we create in a Windows environment but is deployed on Linux. These configuration files reference each other with filepaths. We've had problems with case-sensitivity and trailing spaces before, and I'd like to write a script that checks for these problems. We have Cygwin if that helps. Example...

How to Extract the key from unnecessary Html Wrapping in python

The HTML page containing the key and some \n character .I need to use only key block i.e from -----BEGIN PGP PUBLIC KEY BLOCK----- to -----END PGP PUBLIC KEY BLOCK----- and after putting extracting key in a file can i pass it in any function.... ...

Django : save a new value in a ManyToManyField

Hi, I gave details on my code : I don't know why my table is empty (it seems that it was empty out after calling save_model, but I'm not sure). class PostAdmin(admin.ModelAdmin): def save_model(self, request, post, form, change): post.save() # Authors must be saved after saving post print form.cleaned_data[...

Can I write a screencapture in Python

Are there any libraries to that can be used to write a screen capture in Python. Can it be made to be cross-platform? Is it possible to capture to video? And if could that be in real-time? Or would it be possible to directly generate flash movies? ...

pytz utc conversion

Hi, What is the right way to convert a naive time and a tzinfo into an utc time? Say I have: d = datetime(2009, 8, 31, 22, 30, 30) tz = timezone('US/Pacific') First way, pytz inspired: d_tz = tz.normalize(tz.localize(d)) utc = pytz.timezone('UTC') d_utc = d_tz.astimezone(utc) Second way, from UTCDateTimeField def utc_from_localt...

Python in the enterprise: Pros and cons

I have been exploring and developing an application in Python for mission critical work in the commercial banking arena. Banks are way conservative in selecting new applications. I need real proof of stability and others using. Have looked at the Python site but now I'm hoping this crowd can tell me more. So far I don't have a deve...

Finding set difference between two complex dictionaries

Hi, I have two dictionaries of the following structure: a) dict1 = {'a':[ [1,2], [3,4] ], 'b':[ [1,2],[5,6] ]} b) dict2 = {'a':[ [1,2], [5,6] ], 'b':[ [1,2],[7,8] ]} I need to find the set difference between each key in the dictionary i.e., dict1['a'] - dict2['a'] should return [3,4]. Any thought is appreciated. ...

Creating database schema for parsed feed

Additional questions regarding SilentGhost's initial answer to a problem I'm having parsing Twitter RSS feeds. See also partial code below. First, could I insert tags[0], tags[1], etc., into the database, or is there a different/better way to do it? Second, almost all of the entries have a url, but a few don't; likewise, many entries ...

Homework: Triangle angle calculation all sides known

I know I should do my homework on my own but I simply cant get my homework to work the way I want it to: from __future__ import division import turtle import math def triangle(c,a,b,beta,gamma): turtle.forward(c) turtle.right(180+beta) turtle.forward(a) turtle.right(beta) turtle.left(beta+gamma) turtle.forward(b...

Raising an exception on updating a 'constant' attribute in python

As python does not have concept of constants, would it be possible to raise an exception if an 'constant' attribute is updated? How? class MyClass(): CLASS_CONSTANT = 'This is a constant' var = 'This is a not a constant, can be updated' #this should raise an exception MyClass.CLASS_CONSTANT = 'No, this cannot be updated, ...

How to make several plots on a single page using matplotlib?

I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single page/window. Also for some reason the format of the numbins and defaultreallimits doesn't hold past figure 1. Do I need to use the subplo...

Wildcard Downloads with Python

How can I download files from a website using wildacrds in Python? I have a site that I need to download file from periodically. The problem is the filenames change each time. A portion of the file stays the same though. How can I use a wildcard to specify the unknown portion of the file in a URL? ...

PyObjc and Cocoa on Snow Leopard

I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into Univ...