python

Navigation graphics overlayed over video

Hey, Imagine I have a video playing.. Can I have some sort of motion graphics being played 'over' that video.. Like say the moving graphics is on an upper layer than the video, which would be the lower layer.. I am comfortable in a C++ and Python, so a solution that uses these two will be highly appreciated.. Thank you in advance, Ri...

Critiquing my first Python script

A little bit of background: I'm building an inverted index for a search engine. I was originally using PHP, but because of the amount of times I needed to write to disk, I wanted to make a threaded indexer. There's a problem with that because PHP is not thread safe. I then tried Java, but I ended up with at least 20 try catch blocks bec...

app_label in an abstract Django model

Hi all, I'm trying to get an abstract model working in Django and I hit a brick wall trying to set the related_name per the recommendation here: http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name This is what my abstract model looks like: class CommonModel(models.Model): created_on = models.DateTi...

Regex optional match in python fails

tickettypepat = (r'MIS Notes:.*(//p//)?.*') retype = re.search(tickettypepat,line) if retype: print retype.group(0) print retype.group(1) Given the input. MIS Notes: //p// Can anyone tell me why group(0) is MIS Notes: //p// and group(1) is returning as None? I was originally using regex because, before I ran into problems ...

how to install urlgrabber on windows?

I downloaded urlgrabber-3.1.0 from official site. But I don't know how to install it on windows. could anyone tell me how to install? ...

Python iterator question

I have this list: names = ['john','Jonh','james','James','Jardel'] I want loop over the list and handle consecutive names with a case insensitive match in the same iteration. So in the first iteration I would do something with'john' and 'John' and I want the next iteration to start at 'james'. I can't think of a way to do this using ...

limiting the rate of emails using python

I have a python script which reads email addresses from a database for a particular date, example today, and sends out an email message to them one by one. It reads data from MySQL using the MySQLdb module and stores all results in a dictionary and sends out emails using : rows = cursor.fetchall () #All email addresses returned that ar...

Ways of breaking down SQL transactional/call data into reports -- 'square data'?

I've got a large database of call-traffic information (although the question could be answered with any generic data set.) For instance, a row contains : call endpoint server (endpoint_name) call endpoint status (sip_disconnect_reason) call destination (destination) call completed (duration) [duration >0 is completed] call account group...

str is not callable error in python .

import sys import md5 from TOSSIM import * from RadioCountMsg import * t = Tossim([]) #The Tossim object is defined here m = t.mac()#The mac layer is defined here , in which the communication takes place r = t.radio()#The radio communication link object is defined here , as the communication needs Rf frequency to transfer t.addChanne...

how to pass a command line argument to a c++ file through a python code?

i am compiling a c++ file in python code using this os.system("rc.cpp") and then os.system("./a.out") . I would like to pass a command line argument to the rc file . how do i do it? ...

Where can I find a large body of *Python3* source code?

I'm testing a Python parser. I have Python 2.6/2.7 firmly under control, and some good (large) code samples on which I've tested it. I'm interested in testing my Python3 variant. I've been to various Python open source web sites (e.g., http://pythonsource.com/), which list lots of packages, but they are pretty unclear as whether the...

how to kill (or avoid) zombie processes with subprocess module

When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess "completes". I am unable to kill this subprocess unless I kill my parent python process. Is there a way to kill the subprocess without killing the parent? I know I can do this by using wait(), b...

Set language code inside a view in django

How do I set the language code inside a view (in django)? I'm sending a HttpResponse that contains a python-date.strftime("%A"). %A is the day (e.g. 'Monday'), but I want to get the day in Swedish instead of English. ...

Bypass django form validation on new form instance

Hello! I have a situation where we are trying to autofill some form data on the second page of a signup and I was wondering if there's a way to bypass the entire form validation when we pass in only a couple of fields? so we have something like form = NewForm(request.POST) Where request.POST only contains some of the fields in NewFor...

is a there md5 decrypt function in python ?

i used md5.new() ; md5.update("aaa"),md5.digest() to form a md5 hash of the data "aaa" . How to get back the data using python? ...

Python Reporting Frameworks

Does anyone have/know of a Python Reporting Framework along the lines of what something like DynamicReports does? ...

Problem with list slice syntax in python

The extended indexing syntax is mentioned in python's doc. slice([start], stop[, step]) Slice objects are also generated when extended indexing syntax is used. For example: a[start:stop:step] or a[start:stop, i]. See itertools.islice() for an alternate version that returns an iterator. a[start:stop:step] works as described. But what ...

In python beyond 'exec string' is there a way to 'import' using the db as a filesystem

Although it does not seem possible, I wanted to put this out there to see if others had some innovative solutions to 'dynamically loading and executing code in python' So if one saved code in a database, one could read it and 'exec it', however if one wanted to use it in a similar fashion to the filesystem, one would need to 'save an...

Are classes necessary for creating methods (defs) in Python?

Are classes necessary for creating methods (defs) in Python? ...

Third-party titlecase method in Python

The standard string title() method in Python is pretty naive and doesn't correctly handle converting even fairly simple words and phrases to title case (hyphenated words, phrases with quotes, phrases with prepositions, etc.). In Googling around, I found a few solutions in different languages to this problem. Can anyone recommend a good ...