On Python 3 file-like objects should have an encoding attribute, I guess?  I haven't actually encountered this issue except during debugging if an exception is raised while inside the 'silence' context manager
Adds a possible workaround to https://github.com/astropy/astropy-helpers/issues/45

This is to prevent things from blowing up when using ah_bootstrap with a
version of setuptools afflicted by
https://bitbucket.org/pypa/setuptools/issue/141

The issue here is that if there is already a local copy of
astropy-helpers, but a more recent version is found on PyPI, rather than
allowing the more recent version to *replace* the existing version on
sys.path it blows up with a VersionConflict (sort of defeating the
purpose).  The fix avoids adding any found local versions to the main
pkg_resources.working_set until after the check for an upgrade (and if
an upgrade is found it is added to the main working_set instead of the
local copy).

This *may* still blow up if the user has actually installed
astropy-helpers on one of their default sys.path entries.  But that's
fairly unlikely (and if they have the solution is to simply uninstall
it, or to upgrade setuptools).