Mixing pysnmp and stdin

Depending on the application, sometimes you want to have some socket operations going (such as loading a website) and have stdin being read. There are plenty of examples for this in python which usually boil down to making stdin behave like a socket and mixing it into the list of sockets select() cares about.

A while ago I asked an email list could I have pysnmp use a different socket map so I could add my own sockets in (UDP, TCP and a zmq to name a few) and the Ilya the author of pysnmp explained how pysnmp can use a foreign socket map.

A python utf gotcha

This one had me stumped for a while: # -*- coding: utf-7 -*- import datetime from sqlalchemy import ForeignKey, Column from sqlalchemy.types import Integer, Unicode, Boolean, DateTime default_due_date = datetime.datetime.now() + datetime.timedelta(days=30) Syntax error found on last line. Hmm, bring up a python interpreter and type the last line in with the imports. Works fine.

python and rrdtool

RRDTool is a neat utility for collecting and graphing statistics such as server loads or network traffic. There are two main modules for interfacing with RRDTool files within python; rrdpython and pyrrd. rrdpython is the basic bindings of the rrdtool library within python. The API is very familiar for people who program in C or