Installing psycopg2 on OSX 10.5

October 25th, 2009 § 1

Just a little tip if you get stuck installing the PostgreSQL Python database adaptor as I did. Here is the error I got when running setup.py install (I downloaded the source after easy_install failed to work):

building 'psycopg2._psycopg' extension
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation

The solution is to download the psycopg2 source, then edit the setup.py - around line 426 before after “undef_macros[]” add this:

,extra_link_args = ['-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib']

So that line will look like this:

undef_macros=[],extra_link_args=['-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib'])) 

That is all, running ’sudo python setup.py install’ should get it working.

Share/Save/Bookmark

OpenID + DB Authentication in Pylons is easy with RPX

June 2nd, 2009 § 8

This post will walk you through the steps I took to enable OpenID login in a project I am working on. I wanted to enable OpenID alongside existing user data stored in MySQL database.

 

Login Screen for Pylons

This tutorial actually covers more than just the subject of OpenID; it shows how to create your own custom authentication and authorization in Pylons, and how to create your own authorization decorators to protect Pylons actions.

I will assume you already have Pylons, SQLAlchemy, Mako, and MySQL installed, and will start by creating a new Pylons project project for this tutorial.

» Read the rest of this entry «

Share/Save/Bookmark

Python CSV to Fixed Sized Text Tables

December 5th, 2008 § 0

Here is a quick and simple Python class I hacked up to take comma separated values and reformat them to a fixed column text table. Supports multi-line rows, column width limits, and creates a header row automatically using the data from the first row of the CSV input.

» Read the rest of this entry «

Share/Save/Bookmark

Where Am I?

You are currently browsing entries tagged with Python at Tony Landis.