Server Cobra Ubuntu, Servers, Python, and Django

3Nov/110

Dive Into Python Mirror

Recently, DiveIntoPython.org was taken down. It is was a site/book written by Mark Pilgrim to help you learn Python. It is how I taught myself Python, and still a very valuable resource that I go back to time and time again. Unfortunately, Mark has taken down all of his sites on the Internet, with no notice/explanation.  Luckily, he has provided all of his sites under open licenses, allowing and encouraging people to mirror them. I bought DiveIntoPython.net, and found an old copy of his site, and put it up. Unfortunately, it is not complete: it is still missing some of the downloads and all of the translations. If you have copies of the files or the translations, please leave a comment or email me.

Likewise, I have also mirrored DiveIntoPython3 at DiveIntoPython3.net and DiveIntoHTML5 at DiveIntoHTML5.net.

Tagged as: No Comments
31Jan/110

Python: Make Directory

As I read other people's Python code, I notice almost every project has a utils.py file. I'm going to shamelessly post the most interesting (or most useful) bits that I find, with proper credit. The first one is from my work on modifying Gitosis to use a MySQL backend. Here's a quick way to make a directory:

"""
Create a new directory on a Unix system

@param directory_path
@param (optional) permissions

@exception OSERROR If directory cannot be made
"""
def mkdir(*a, **kw):
    try:
        os.mkdir(*a, **kw)
    except OSError, e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise

Credit goes to the Gitosis project.

Tagged as: , No Comments