Python development environment

Brew up python


pip install yolk
pip install nose
pip install PasteScript

make new working directory
cd into working directory
paster create -t basic_package <pkgname>
(( respond to prompts ))
cd <pkgname>
git init
curl > .gitignore
git add <pkgname> setup.* .gitignore
git commit -m "initial commit; includes github gitignore file"
(( hook up to github if desired ))

Job: Senior Digital Humanities Web Developer/Architect

Reblogged from

In order to shape and secure the future of innovative teaching and research at ISAW and beyond, we work with others to nurture new and important open information resources for the ancient world, especially those that connect and contextualize information across institutional, methodological, and technological divides. Accordingly, our Senior Digital Humanities Web Developer/Architects envision, create, and curate web applications that bridge gaps in content and function while handling the diversity of languages, scripts, geography, chronology, and methodology inherent in the study of the past-oriented humanities. You carry out this mission in constant, productive collaboration with scholars, students, and enthusiasts from both inside and outside the Institute, empowering them as co-creators, curators, and users.

Position description and application instructions may be found online at:

Get a List of Machine Tags from the Flickr API

I want to know what Pleiades machine tags are in use on photos throughout Flickr (more background here). I thought I'd learn how to ask for that information from the Flickr API via a script. I requested and got an API key (see I set up a Python virtual environment and git repository for the project. I went looking for Python code that already implemented interaction with the API and settled (somewhat arbitrarily) on Beej's Python Flickr API kit (now maintained by Sybren Stüvel). Then used pip install flickrapi to get the package.

Here's a command-line session running the script and showing its output:

(pleiades-flickr)darkstar:pleiades-flickr paregorios$ python src/ 
pleiades:atteststo is used on 15 photos in Flickr
pleiades:denotes is used on 1 photos in Flickr
pleiades:depcits is used on 2 photos in Flickr
pleiades:depicts is used on 7229 photos in Flickr
pleiades:findspot is used on 2197 photos in Flickr
pleiades:finspot is used on 2 photos in Flickr
pleiades:foundat is used on 1 photos in Flickr
pleiades:observedat is used on 3 photos in Flickr
pleiades:origin is used on 225 photos in Flickr
pleiades:place is used on 970 photos in Flickr
pleiades:places is used on 19 photos in Flickr
pleiades:where is used on 119 photos in Flickr
(pleiades-flickr)darkstar:pleiades-flickr paregorios$

Here's the code (version at github):

#!/usr/bin/env python
A Flickr tag bot

import argparse
import flickrapi
import json
import logging as l
import os
import sys
import traceback

from myflickr import API_KEY, NAMESPACE_DEFAULT

SCRIPT_DESC = "poll machine tags from flickr"

def main ():
""" Unleash the bot! """

global args
global l

flickr = flickrapi.FlickrAPI(API_KEY)
resp = flickr.machinetags_getPairs(namespace=args.namespace, format="json")
if resp[:14] == "jsonFlickrApi(":
jstr = resp[14:-1]
j = json.loads(jstr)
ptags = [(p['_content'], p['usage']) for p in j['pairs']['pair']]
for ptag in ptags:
print "%s is used on %s photos in Flickr" % ptag

if __name__ == "__main__":
parser = argparse.ArgumentParser(description=SCRIPT_DESC, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument ("-n", "--namespace", default=NAMESPACE_DEFAULT, help="namespace to use in requesting machine tags")
parser.add_argument ("-v", "--verbose", action="store_true", default=False, help="verbose output")
args = parser.parse_args()
if args.verbose:
except KeyboardInterrupt, e: # Ctrl-C
raise e
except SystemExit, e: # sys.exit()
raise e
except Exception, e:
print str(e)

Comments, questions, and constructive criticism welcomed!