Skip to content

Category Archives: Python

Python specific articles

Installing easy_install on Windows 7 using Python 2.7

20-Aug-10

Apparently Python 2.7 doesn’t come with setuptools installed, and thus, easy_install doesn’t work. I really miss my OSX, but this new job requires Windows because we have SDKs that we work with that are Windows only. So be sure to download and run ez_setup.py after you install Python 2.7, and then be sure to add [...]

Get All Views from All Databases in CouchDB

11-May-10

Here is a little code snippet on how to get a list of all the Views from all the Design Documents from all the Databases in a CouchDB instance with couchdbkit. #!/usr/bin/env python from couchdbkit import * server = Server() dbs = server.all_dbs() for dbname in dbs:     db = server.get_or_create_db(dbname)     result = db.all_docs(startkey=’_design’, endkey=’_design0′)     for [...]

CouchDB launchctl external httpd handlers permissions madness on OSX

30-Apr-10

I had my CouchDB development environment up and running along just fine until I tried to start adding external httpd handlers written Python. I was starting my CouchDB instance with sudo launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist and stopping it with sudo launchctl unload -w /Library/LaunchDaemons/org.apache.couchdb.plist I would get a cryptic Erlang message with ‘OS Process timeout’. [...]

Python Remote SSH with Paramiko

10-Feb-10

I am using Paramiko to do some remote ssh work and could not figure out how to change directories and execute a script with the SSHClient.execute_command() function. I finally figured out that .execute_command() is basically a single session, so doing a .execute_command(‘cd scripts’) and then executing the script with another .execute_command() reverts back to your [...]

Python/Twisted vs Erlang/OTP

15-Oct-09

A long time user of Python and Twisted, I have used Python and Twisted to developed some production systems that processed 60 – 80 million messages a day. It wasn’t pretty but the code base was fairly small and it worked, but not simply. Our deployment machines were Sun T1000 Niagara based machines. We were [...]

Object Oriented Python File Selection

13-Oct-09

Here is some Python code I have found useful when working with selecting files in the filesystem to operate on. This FileSet object works very much like the Java Ant task of the same name. class Action:     """     Actions are things that can be executed.     """     def execute(self):         pass class PatternSet:     """     Pattern set provides [...]