Archive for the 'Python' Category

Django tutorial - a fix to an error I was getting

This post is for my future reference and for those searching for a solution.

In Chapter 4 of the Django book, I was getting a DJANGO_SETTINGS_MODULE error when trying to run:

from django.template import Template from the interpreter

To fix (in Cygwin), I used this command from the bash command line of Cygwin:

export DJANGO_SETTINGS_MODULE=settings

My home directory is “home/username” and the project lived underneath that in “mysite”. “home/username/mysite” is in both the PATH and PYTHONPATH environment variable.

First Public Python Program

A few months ago I dinked around with creating a validator for chess games stored in Forsyth-Edwards notation. Since I tinker around in Python, I decided to try to act like a real programmer instead of a hobbiest that creates ugly, unmaintainable code. I’m amateur enough not to know if I suceeded. In any case, I decided to make the program available under the CC-GNU GPL.

Source and, of course, my unit tests.

Get it yet?

Python’s list comprehensions are a beautiful thing. Even better is reading and re-reading a tutorial and finally getting it to sink in on how to use them in your own work. Went from some ugly code to something much more beautiful, to-the-point and understandable.

Is it Perl or Is it Python?

You too can make your Python code look like Perl. [via Daily Python-URL]

All kidding aside, it’s neat to see what you can do to cram code into a tight package for a contest. Just don’t ask me to figure out how it works.

Python 2.3

Python 2.3 was released yesterday. Nothing like installing new software at 6 am!