python

Apache sockets not closing?

I have a web application written using CherryPy, which is run locally on 127.0.0.1:4321. We use mod-rewrite and mod-proxy to have Apache act as a reverse proxy; Apache also handles our SSL encryption and may eventually be used to transfer all of our static content. This all works just fine for small workloads. However, I recently used...

WPF Alternative for python

Is there any alternative for WPF (windows presentation foundation) in python? http://msdn.microsoft.com/en-us/library/aa970268.aspx#Programming_with_WPF ...

What do you think of the new functionality in Python 2.6?

What features do you think will be most useful in python 2.6 now that it's been released? Can you think of any clever uses to all the new functionality? for example do you see yourself using ABCs, class decorators and multiprocessing? or do you think that the new developments is wont be of much use? Just want to hear people's opinions....

How do I deploy a Python desktop application?

I have started on a personal python application that runs on the desktop. I am using wxPython as a GUI toolkit. Should there be a demand for this type of application, I would possibly like to commercialize it. I have no knowledge of deploying "real-life" Python applications, though I have used py2exe in the past with varied success. How...

Change Django Templates Based on User-Agent

I've made a Django site, but I've drank the Koolaid and I want to make an IPhone version. After putting much thought into I've come up with two options: Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework. Find some time of middleware that reads the user-agent, and changes the templa...

Programmatically launching standalone Adobe flashplayer on Linux/X11

The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full screen without any hum...

How would I package and sell a Django app?

Currently I am hosted a Django app I developed myself for my clients, but i am now starting to look at selling it to people for them to host themselves. My question is this: How can i package up and sell a Django app, but also protect my code from pirating or theft. Distributing a bunch of .py files doesn't sound like a good idea as the...

Detecting Mouse clicks in windows using python

How can I detect mouse clicks regardless of the window the mouse is in? Perferabliy in python, but if someone can explain it in any langauge I might be able to figure it out. I found this on microsoft's site: http://msdn.microsoft.com/en-us/library/ms645533(VS.85).aspx But I don't see how I can detect or pick up the notifications list...

Python object attributes - methodology for access

Hello, Suppose I have a class with some attributes. How is it best (in the Pythonic-OOP) sense to access these attributes ? Just like obj.attr ? Or perhaps write get accessors ? What are the accepted naming styles for such things ? Edit: Can you elaborate on the best-practices of naming attributes with a single or double leading under...

How can I capture all exceptions from a wxPython application?

I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash? Ideally I'd want to capture all output (not just er...

How to build and deploy Python web applications

I have a Python web application consisting of several Python packages. What is the best way of building and deploying this to the servers? Currently I'm deploying the packages with Capistrano, installing the packages into a virtualenv with bash, and configuring the servers with puppet, but I would like to go for a more Python based solu...

Django, mod_python, apache and wacky sessions

I am running a Django through mod_python on Apache on a linux box. I have a custom authentication backend, and middleware that requires authentication for all pages, except static content. My problem is that after I log in, I will still randomly get the log in screen now and again. It seems to me that each apache process has it's own py...

Clearing a list

I find it annoying that I can't clear a list. In this example: a = [] a.append(1) a.append(2) a = [] The second time I initialize a to a blank list, it creates a new instance of a list, which is in a different place in memory, so I can't use it to reference the first, not to mention it's inefficient. The only way I can see of retain...

Is it worthwhile to write a programming tutorial book?

I have written an introductory Python tutorial and I'm working on one for wxPython. My Python tutorial was used at a college for a programming introduction class. I know the answer is probably "if you want to", but I'm curious to know if I should take the time to formalize my tutorials into a book format, most likely as an ebook. I don'...

Finding local IP addresses in Python.

How can I find the local IP address (i.e. 192.168.x.x or 10.0.x.x) in python, preferably with only built-in moduals, I would also like it to be platform independent. ...

Finding a public facing IP address in Python?

How can I find the public facing IP for my net work in Python? ...

Calling Python in PHP

I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac. I don't want to go through the minor trouble of installing mod_python or mod_wsgi on my Mac, so I was just going to do a system() or popen() from PHP to call the Python...

Removing a subset of a dict from within a list

This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this: a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toRemove = [] for var in a.iterkeys(): if var in exclusion: toRemove.appen...

Problem With Python Sockets: How To Get Reliably POSTed data whatever the browser?

Hello, I wrote small Python+Ajax programs (listed at the end) with socket module to study the COMET concept of asynchronous communications. The idea is to allow browsers to send messages real time each others via my python program. The trick is to let the "GET messages/..." connexion opened waiting for a message to answer back. My probl...

How do I enter a pound sterling character (£) into the Python interactive shell on Mac OS X?

Update: Thanks for the suggestions guys. After further research, I’ve reformulated the question here: Python/editline on OS X: £ sign seems to be bound to ed-prev-word On Mac OS X I can’t enter a pound sterling sign (£) into the Python interactive shell. Mac OS X 10.5.5 Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) European keyboar...