python

Python complex event processing

Are there any Python alternatives similar to Esper (Java and .NET) that deal with complex event processing (CEP)? ...

Can Python xml ElementTree parse a very large xml file?

I'm trying to parse a large file (> 2GB) of structured markup data and the memory is not enough for this.Which is the optimal way of XML parsing class for this condition.More details please. ...

I need MSVCR90.dll version 9.0.21022.8

According to a py2exe tutorial I found I need MSVCR90.dll version 9.0.21022.8 to run it for python 2.6. Where do I find MSVCR90.dll version 9.0.21022.8? ...

What does this python syntax mean?

I am not a python guy and I am trying to understand some python code. I wonder what the last line of below code does? Is that kind of multiple objects returned? or list of 3 objects returned? req = SomeRequestBean() req.setXXX(xxx) req.YYY = int(yyy) device,resp,fault = yield req #<----- What does this mean ? ...

Why are collections not handled uniformly in Python?

Sets and lists are handled differently in Python, and there seems to be no uniform way to work with both. For example, adding an item to a set is done using the add method, and for the list it is done using the append method. I am aware that there are different semantics behind this, but there are also common semantics there, and often a...

executing programs without python installed

its possible to execute a python program on system where python is not installed? I want to execute my python program like c program I compile it on linux and then I can execute on any linux system ...

Find associated value to a keyword in file with python

Sorry for the beginner python question, but I cant find anywhere how to do this, so bear with me. I am trying to extract the values from a file containing keyword followed by a value: Example: length 95 width 332 length 1253 length 345 width 22 How do I extract all the values assosiated with the keyword "length" for example? ...

Crop non symmetric area of an image with Python/PIL

Is there a way to cut out non rectangular areas of an image with Python PIL? e.g. in this picture I want to exclude all black areas as well as towers, rooftops and poles. http://img153.imageshack.us/img153/5330/skybig.jpg I guess the ImagePath Module can do that, but furthermore, how can I read data of e.g. a svg file and convert it in...

How to write find-all function (with regex) in awk or sed

I have bash function which run python (which return all finded regex from stdin) function find-all() { python -c "import re import sys print '\n'.join(re.findall('$1', sys.stdin.read()))" } When I use this regex find-all 'href="([^"]*)"' < index.html it should return first group from the regex (value of href attribute from file in...

Create user page at subdomain

How to implement automatic page creation on a subdomain when a new user registers on the site? (Working in Python on the Plone CMS and Zope web app server) ...

Python smtplib and pipelining

Hi there, recently i'm studing the smtplib smtp client library for python, but i could not find any reference to the PIPELINING protocol against smtp servers that support it. Is there something i'm missing? It's not yet implemented maybe? Any other implementations rather than smtplib with PIPELINING enabled? Thanks ...

Foreign Key relations in Django, with a select condition

I've a table of partner type PartnerType Name Description RelatedToProject I've a PartnerMaster Name Address PartnerType I've a Project Table Name Partner (from partner master) The partner in the project table has to be only of those types who have RelatedToProject = True How can I achieve this in the model definition itself. ...

How to Escape Single Quotes in Python on Server to be used in Javascript on Client

>>> sample = "hello'world" >>> print sample hello'world >>> print sample.replace("'","\'") hello'world In my web app I need to store my python string with all single quotes escaped for manipulation later in the client browsers javascript. Trouble is python uses the same backslash escape notation so the replace operation as detailed ab...

Translation UrlOpen error in python

Hi , We are trying to do translation in our code written in Ruby On Rails using a python code . But i am getting the error as raise TranslationError, "Failed translating (getting %s failed): %s" % (e.url, e.error) translate.TranslationError: Failed translating (getting http://ajax.googleapis.com/ajax/services/language/translate...

Regular Expression (Python) to extract strings of text from inside of < and > - e.g. <stringone><string-two> etc...

I'm currently playing with the Stack Overflow data dumps and am trying to construct (what I imagine is) a simple regular expression to extract tag names from inside of < and > characters. So, for each question, I have a list of one or more tags like <tagone><tag-two>...<tag-n> and am trying to extract just a list of tag names. Here are...

Tree traversal with page property sortIndex

I'm building a tree structure based on a list retrieved from a db.Model called Pages. Each Page entry has a parentKey property that's a db.SelfReferenceProperty() and a db.IntegerProperty() called sortIndex. I fetch the list and call a method to travers over the list and make a nestled dict as my tree. The reason I fetch the entire li...

Lookup Error after packaging python script with py2exe

I have written a python script which binds to a socket like this: from socket import * addr = (unicode(), 11111) mySocket = socket(AF_INET, SOCK_STREAM) mySocket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) mySocket.bind(addr) I package this script with py2exe using setup.py with the following options: setup( console=["myProgram.py"],...

Django for enterprise web application

Hey all I wanted to know is Django a good choice for a big web applicatin(Social Network)? More specifically, I need some suggestion on performace when number of DB transactions increases and I want to know is the embedded OR Mapping included inside Django is a good choice or should I implement them. Thanks ...

Creating a Hierarchical Build with SCons

I have a library project that contains some samples in a subfolder. The library itself has a SConstruct file and each sample has its own folder and its own SConstruct file. I'd like to add a target to the main (root) SConstruct file which would allow me to compile the library as usual, and all the samples, at once. Is there an existin...

examples of common middleware people use in pylons?

Just trying to get a feel for what common middleware people use in pylons? Is middleware just the main pipeline for the request and response object? i.e. would it be possbile to create a very simple middleware that outputs 'hello world' to the screen? ...