Use sys.getdefaultencoding() instead of "ascii" per David's suggestion.