If all you want is to print the error, you don't need to unpack it
into separate components at all: just do
	try:
		...
	except IOError, msg:
		print "I/O Error:", msg
Otherwise, you can use the type() and len() functions to detect what
kind of error data you have, e.g.
	if type(msg) == type(()): # It's a tuple
		if len(msg) == 2:
			left, right = msg
			print left, ":", right
		elif len(msg) == 4:
			errortype, errorcode, errormsg, messageobject = msg
			if errorcode == 404:
				...
			etc.
		else:
			print msg	# Tuple of other size
	else:
		print msg	# Not a tuple
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>