python

Python Job Service Daemon?

what packages should i look at for a python daemon, and processing jobs? also who do i need to do for a python daemon? ...

Python HTML to PDF with floating divs

Is there a way to convert XHTML/HTML with CSS to PDF with floating divs? I have tried pisa/xhtml2pdf in python and dompdf in PHP both are not able to do so. Is there any way? ...

How can I put all twill commands together into one piece of code in a .py file?

Hello everybody! I have just started exploring TWILL. Twill is an amazing scripting language for Web browsing and it does all I want!!! So far I've been using twill from a Python shell (IDLE (Python GUI) to be precise) and I do things there in the way of executing commands one by one (I mean, I type one command, run it, then type the...

help with UnicodeEncodeError('ascii', u'Phase \u2013 II', 6, 7, 'ordinal not in range(128)')

Hi, having problem with UnicodeEncodeError('ascii', u'Phase \u2013 II', 6, 7, 'ordinal not in range(128)') Basically what I am doing here is reading the value from excel sheet and sheet contain address in this format Phase- II So wanted to know how to change` somestring = u'Phase \u2013 II' to str thanks ` ...

Write easily readable XML in Python

Is there any way other than creating a method myself to write XML using python which are easily readable? xMLFile.write(xmlDom.toxml()) does create proper xml but reading them is pretty difficult. I tried toprettyxml but doesn't seem like it does much. e.g. following is what I would consider a human readable xml: <myroot> <ent1 ...

How do I simulate a progress counter in a command line application in Python?

My Python program does a series of things and prints some diagnostic output. I would also like to have a progress counter like this: Percentage done: 25% where the number increases "in place". If I use only string statements I can write separate numbers, but that would clutter the screen. Is there some way to achieve this, for example...

Python: combine logging and wx so that logging stream is redirectet to stdout/stderr frame

Here's the thing: I'm trying to combine the logging module with wx.App()'s redirect feature. My intention is to log to a file AND to stderr. But I want stderr/stdout redirected to a separate frame as is the feature of wx.App. My test code: import logging import wx class MyFrame(wx.Frame): def __init__(self): self.logger =...

get average from set of objects in django

Hay, i have a simple rating system for a property. You give it a mark out of 5 (stars). The models are defined like this def Property(models.Model) # stuff here def Rating(models.Model) property = models.ForeignKey(Property) stars = models.IntegerField() What i want to do is get a property, find all the Rating objects, co...

Complex form widgets in Django

I am looking for good helper libraries to generate a rather complex form in Django. Dynamic field dependencies: Say if option a is selected certain fields are shown/hidden and subset of these are mandatory depending on option selection. Add more: On clicking "Add more" button that clones some widget. This is something which ToscaWid...

Permutations in python 2.5.2

Hi, I have a list of numbers for input, e.g. 671.00 1,636.00 436.00 9,224.00 and I want to generate all possible sums with a way to id it for output, e.g.: 671.00 + 1,636.00 = 2,307.00 671.00 + 436.00 = 1,107.00 671.00 + 9,224.00 = 9,224.00 671.00 + 1,636.00 + 436.00 = 2,743.00 ... and I would like to do it in Python My current...

Rare PyCairo antialias getting directly the surface data

After create a Pycairo context and surface (ImageSurface) I get a diferent export results if I get directly from surface buffer surface.get_data() or from PNG export method surface.write_to_png() The context antialias flag is obviously the same and, yes, the get_data method result has antialiasing, but with much poorer quality. Wh...

[python] How to create A matrix of images in opencv with python bindings to feed Kmeans2

Hello , i am trying to cluster a set of images, my peblems resides in using Kmeans2 parameters in opencv. i dont know exactly how to form the points input for Kmeans2 for clustering. here what i do : samples = CreateMat ( samples_len,1,CV_32FC2) labels = CreateMat ( samples_len,1,CV_43SC1) index = 0 for name in imglist : img = ...

what is it in Java standard library that Python's lacks

I hear that Java's standard library is larger than Python's so I'm curious, what's missing in Python's? ...

List Directories and get the name of the Directory

Hello, I am trying to get the code to list all the directories in a folder, change directory into that folder and get the name of the current folder. The code I have so far is below and isn't working at the minute. I seem to be getting the parent folder name. import os for directories in os.listdir(os.getcwd()): dir = os.path.joi...

Django check for any exists for a query

In django how to check whether any entry exists for a query sc=scorm.objects.filter(Header__id=qp.id) This was how it was done in php if(mysql_num_rows($resultn)) { } else { } ...

Facebook Graph API and Django

Hello, I am curious if there is any article/ library / anything useful that is built for the newly announced Facebook Graph API. I am planning to use it for a Python/Django project. ...

Using sphinx to create context sensitive html help

Hi all, I am currently using AsciiDoc (http://www.methods.co.nz/asciidoc/) for documenting my software projects because it supports pdf and html help generation. I am currently running it through cygwin so that the a2x tool chain functions properly. This works well for me but is a pain to setup on other windows computers. I have been lo...

netbeans ide python: how to increase VM heap size

Hello, Can I ask how I can increase the heap memory in NetBeans IDE 6.7 for Python? I am getting "java.lang.OutOfMemoryError". I have tried to find a VM option, but I could not find it in "Project Options" (it does not resemble to NetBeans IDE 6.7.1 for Java). I have tried to change default_netbeans option in file netbeans.conf (there i...

a simple smtp server

Could you please suggest a simple SMTP server with the very basic APIs(by very basic I mean, to read,write,delete email) that could be run on a linux box? I just need to convert the crux of the email into XML format and FTP it to another machine. ...

How to add a Facebook Event with new Graph API

I am trying to create an event using Facebooks api. (From a django app) Has anyone created an event with the new graph api? ...