Category Archives: Python

Python 2.5 to 2.4

Last night we ran into a slight problem.  We are running Python 2.5 on our Macbook’s, but our server is running a very stable 2.4.  No problem right? Well kind of.

The first problem we encountered is related to PEP 308.  Someone who had written a RSS parsing plugin for Django, failed to mention that it minimally needed Python 2.5 to run correctly.  But this is one of the greatest advantages of open source.  I rolled up my sleeves and removed what the PEP calls conditional expressions.  I’ve always referred to these as the Ternary operator [or operation]. Continue reading

iPython on Mac OS X

What worked for me; short and simple:

1) Install iPython

  1. sudo easy_install ipython

2) Download the file/egg for Mac OSX readline, and place in path, then edit easy_install.pth

  1. Download:  http://ipython.scipy.org/dist/readline-2.5.1-py2.5-macosx-10.5-i386.egg
  2. cp ~/Downloads/readline-2.5.1-py2.5-macosx-10.5-i386.egg .
  3. sudo vim easy-install.pth
  4. While editing the file add:   ./readline-2.5.1-py2.5-macosx-10.5-i386.egg

3) Run iPython and test.

Django 1.0 install on Mac OS X 10.5.5

I initially used this guide, but made some changes:

1) Downloaded Django-1.0.tar.gz from here.

2) Created and extracted the contents of the tar.gz:

mkdir ~/sandbox
cd ~/sandbox
tar xzf ~/Downloads/Django-1.0.tar.gz

3) Make the following soft-links:

cd /Library/Python/2.5/site-packages/
ln -s ~/sandbox/Django-1.0/django django
cd /usr/local/bin/
sudo ln -s ~/sandbox/Django-1.0/django/bin/django-admin.py django-admin.py

Google App Engine over lunch

I decided to grab lunch and read more of what I could find on Google App Engine (GAE).  Found a few interesting sites.

Steve talks about how GAE fills a much different need in the cloud computing arena than Amazon has done with its own S3 and EC2.  Google doesn’t charge you for the server you rent (i.e. like EC2), but rather they charge you with how much you actually use.

Next up is Shannon, who explains how .NET can leverage GAE through abstraction via a webservice call.

Last up, is a solution I found very interesting.  Andreas explains how GAE can be used as a Content Delivery Network (CDN).  I won’t bother going into details of what a CDN is, it is explained well on his website.  What I found interesting is how this would compare to Amazon’s S3; where I’ve seen several people adopt a similar strategy using Amazon’s S3.

Over the last couple nights, I also watched the GAE video on YouTube introduced in Google Campfire One.  Parts One, Two and Three.

You can download the GAE SDK herePricing is discussed (not confirmed) here.

JSON serialization with Python

First part of the problem: How should objects serialize to JSON, and can this be exchanged between different languages (.NET/Python) without writing custom Encode/Decoding implementations?

Second part: Why does Python’s Pickle serialize (reflect) an object, but simplejson which mimics the exact same interface behave differently? Continue reading

Create simple ANSI based UI with Python-Newt

I stumbled across this simple UI, Python-newt.  Newt which is common to many non-graphic installs on various Linux flavors. Newt is a simplistic UI that lets a programmer specify entry fields, radio buttons, ok/cancel buttons. You name it…

Python-newt Snack Popcorn demo snapshot

The Python extension is called Snack. Read more on support here. Two examples come with the docs, showing how easy it is to assemble UI entry request pages/forms.

Show Me Do screen casts

I came across this site, Show Me Do. I must say I am quite impressed. There are a ton of instructional videos or screen-casts on the website, a lot of which cover topics I am very interested in, Python!

The first one I noticed had a kid who was showing how he used a programming environment called Rur-Ple to write and execute his very own program. That is great to see young kids very interested in tools like these. I remember when I was a kid and wrote BASIC program and saved them to a cassette tape. It seemed to take forever to write or read too the tape.

As I began pouring over the videos, I noted some were introductions into Python, IPython, or PyDB. While I use these tools, I am always willing to learn a new trick here or there that I haven’t uncovered yet.

So here is my assessment of the videos I watched, and following a list of videos I haven’t watched yet.

Continue reading