One concern here:  'ascii' might not be the user's default locale.  Can you replace 'ascii' here with a call to ``sys.getdefaultencoding()``?