python

How do I create a windows service with Python

This is a duplicate of this question. Please close. I really need my python program to run as a windows service. How can I do this? ...

Monitoring files/directories with python

I'm looking for a cross-platform file monitoring python package? I know it is possible to monitor files on windows usung pywin32, and there are packages working on Linux/Unix but does anyone know about a cross-platform one? ...

How can i use TurboMail 3 together with TurboGears 2

Hy, I want to use TurboMail3 (website) together with a TurboGears 2(website) project. Which files to I have to modify to include TurboMail into my TurboGears project? Everything I find on the web is for TurboMail2 and TurboGears1. The TurboMail Documentation states that there actually is a TG2 integration but I never found documentatio...

Why does @foo.setter in Python not work for me?

So, I'm playing with decorators in python 2.6, and I'm having some trouble getting them to work. Here's by class file: class testDec: @property def x(self): print 'called getter' return self._x @x.setter def x(self, value): print 'called setter' self._x = value What I thought this me...

Cheap exception handling in Python?

I read in an earlier answer that exception handling is cheap in Python so we shouldn't do pre-conditional checking. I have not heard of this before, but I'm relatively new to Python. Exception handling means a dynamic call and a static return, whereas an if statement is static call, static return. How can doing the checking be bad and ...

When is it (not) appropriate to bundle dependencies with an application?

Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. I...

Searching a list of objects in Python

Let's assume I'm creating a simple class to work similar to a C-style struct, to just hold data elements. I'm trying to figure out how to search the list of objects for objects with a certain attribute. Below is a trivial example to illustrate what I'm trying to do. For instance: class Data: pass myList = [] for i in range(20):...

Calling function defined in exe

I need to know a way to call a function defined in the exe from a python script. I know how to call entire exe from py file. ...

What SHOULDN'T Django's admin interface be used for?

I've been applying Django's automatic administration capabilities to some applications who had previously been very difficult to administer. I'm thinking of a lot of ways to apply it to other applications we use (including using it to replace some internal apps altogether). Before I go overboard though, is there anything in particular ...

AppEngine: Query datastore for records with <missing> value

I created a new property for my db model in the Google App Engine Datastore. Old: class Logo(db.Model): name = db.StringProperty() image = db.BlobProperty() New: class Logo(db.Model): name = db.StringProperty() image = db.BlobProperty() is_approved = db.BooleanProperty(default=False) How to query for the Logo records, wh...

Where is the function get_example_data in matplotlib? It seems to be missing but its in examples/tutorials

Looking at this tutorial here: link text it references matplotlib.get_example_data('goog.npy'). I get an error when I run this, and furthermore I can't even find the mpl-data/ folder in my macosx installation of matplot lib when searching using Spotlight. Any idea what this function is now called? ...

External classes in Python

I'm just beginning Python, and I'd like to use an external RSS class. Where do I put that class and how do I import it? I'd like to eventually be able to share python programs. ...

How to match a text node then follow parent nodes using XPath

I'm trying to parse some HTML with XPath. Following the simplified XML example below, I want to match the string 'Text 1', then grab the contents of the relevant content node. <doc> <block> <title>Text 1</title> <content>Stuff I want</content> </block> <block> <title>Text 2</title> <content>S...

Python HTML removal

How can I remove all HTML from a string in Python? For example, how can I turn: blah blah <a href="blah">link</a> into blah blah link Thanks! ...

Working with MySQL booleans in python

I am querying a MySQL database in python and selecting a boolean value -- so the response from MySQL is either the string 'True' or 'False'. I would like to execute further code based on the boolean value from MySQL. E.g. data = 'False' # assume this is what was returned by MySQL. if data: print 'Success' #really this would be whe...

Difference between class (Python) and struct (C)

I'm new to python. I've studied C and I noticed that that the C structure (struct) seemed to have the same task as "class" in python. So what is, conceptually, the difference? ...

What's the best technology for connecting from linux to MS SQL Server using python? ODBC?

By best, I mean most-common, easiest to setup, free. Performance doesn't matter. ...

py2exe page says it is licensed under GPL, can I still use it in a python project that is not GPL?

This page says that py2exe is GPL licensed (bottom of the page) My concern is that you have to distribute some of the files they generate. I think this would be allowed with LGPL, but not GPL. <--- Please address this in your answer. My final product would not be GPL and will not give out source code. Update: Please see my answer b...

How can I manually register distributions with pkg_resources?

I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine. There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of ...

Authentication Required - Problems Establishing AIM OSCAR Session using Python

I'm writing a simple python script that will interface with the AIM servers using the OSCAR protocol. It includes a somewhat complex handshake protocol. You essentially have to send a GET request to a specific URL, receive XML or JSON encoded reply, extract a special session token and secret key, then generate a response using the token ...