python

get all of the immediate subdirectories in python

I'm trying to write a simple python script that will copy a index.tpl to index.html in all of the subdirectories (with a few exceptions). But I'm getting bogged down by trying to get the list of subdirectories ...

How to initialize variables to None/Undefined and compare to other variables in Python?

Basically I have some variables that I don't want to preinitialize: originalTime = None recentTime = None postTime = None def DoSomething ( ) : if originalTime == None or (postTime - recentTime).seconds > 5 : ... I get compile error on the if: UnboundLocalError: local variable 'originalTime' referenced before assignment ...

About GUI editor that would be compatible with Python 3.0

Hi there, I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Pyt...

Nice IDE for wxPython or Tkinter GUI Development

I've had a little experience developing small command-line apps with Python, I want to move on to developing GUI's with Python, from all the GUI frameworks for Python the ones I feel most inclined to are wxPython and Tkinter but I don't want to code all the GUI by myself at this time. Is there any good GUI IDE for any of this frameworks...

Looking for a PHP and/or Python RAD

I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on wh...

C# Nmath to Python SciPy

Hello everyone! I need to port some functions from C# to Python, but i can't implement next code right: [SqlFunction(IsDeterministic = true, DataAccess = DataAccessKind.None)] public static SqlDouble LogNormDist(double probability, double mean, double stddev) { LognormalDistribution lnd = new LognormalDistribution(mean,stddev); ...

Django equivalent of PHP's form value array/associative array

In PHP, I would do this to get name as an array. <input type"text" name="name[]" /> <input type"text" name="name[]" /> Or if I wanted to get name as an associative array: <input type"text" name="name[first]" /> <input type"text" name="name[last]" /> What is the Django equivalent for such things? ...

Updating data in google app engine

I'm attempting my first google app engine project – a simple player stats database for a sports team I'm involved with. Given this model: class Player(db.Model): """ Represents a player in the club. """ first_name = db.StringProperty() surname = db.StringProperty() gender = db.StringProperty() I want to make a basic ...

Why Python informixdb package is throwing an error!

I have downloaded & installed the latest Python InformixDB package, but when I try to import it from the shell, I am getting the following error in the form of a Windows dialog box! "A procedure entry point sqli_describe_input_stmt could not be located in the dynamic link isqlit09a.dll" Any ideas what's happening? Platform: Windows Vi...

Is Python faster and lighter than C++?

I've always thought that Python's advantages are code readibility and development speed, but time and memory usage were not as good as those of C++. These stats struck me really hard. What does your experience tell you about Python vs C++ time and memory usage? ...

How to put timedelta in django model?

With inspectdb I was able to get a "interval" field from postgres into django. In Django, it was a TextField. The object that I retrieved was indeed a timedelta object! Now I want to put this timedelta object in a new model. What's the best way to do this? Because putting a timedelta in a TextField results in the str version of the obje...

Notifying container object: best practices

I have two classes: Account and Operator. Account contains a list of Operators. Now, whenever an operator (in the list) receives a message I want to notify Account object to perform some business logic as well. I think of three alternatives on how to achieve this: 1) Hold a reference within Operator to the container [Account] object an...

Changing user agent on urllib2.urlopen

How can I download a webpage with a user agent other than the default one on urllib2.urlopen? ...

Face-tracking libraries for Java or Python

Hi, I'm looking for a way to identify faces (not specific people, just where the faces are) and track them as they move across a room. We're trying to measure walking speed for people, and I assumed this would be the easiest way of identifying a person as a person. We'll have a reasonably fast camera for the project, so I can probably...

How can I enumerate/list all installed applications in Windows XP?

When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs]. I would prefer to do it in Python, but C or C++ is also fine. ...

`final` keyword equivalent for variables in Python?

I couldn't find documentation on an equivalent of Java's final in Python, is there such a thing? I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for this. ...

Python - Possible to force raise exceptions regardless try/except blocks?

In Python is there any language (or interpreter) feature to force the python interpreter to always raise exceptions even if the exception offending code is inside a try/except block ? I've just inherited a larger and old codebase written in python, whose purpose is to communicate with some custom designed hardware we also developed. Ma...

Getting realtime output using subprocess

I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output. I figured that I'd just execute the program using subprocess.Popen, use stdout=PIPE, t...

Inserting multiple model instances using a single db.put() on Google App Engine

Edit: Sorry I didn't clarify this, it's a Google App Engine related question. According to this, I can give db.put() a list of model instances and ask it to input them all into the datastore. However, I haven't been able do this successfully. I'm still a little new with Python, so go easy on me list_of_models = [] for i in range(0, len...

Merge two lists of lists - Python

This is a great primer but doesn't answer what I need: http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python I have two Python lists, each is a list of datetime,value pairs: list_a = [['1241000884000', 3], ['1241004212000', 4], ['1241006473000', 11]] And: list_x = [['1241000884000', 16], ['1241000992000', 16...