@Swoboderz which extension are you trying to use?
You will note that that chunk if code is using errors, encoding, etc. However:
>>> dir(sys.stdout)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'encoding', 'flush', 'isatty', 'write', 'writelines']
notice there is no errors attribute.
So, before calling that code (probably in your script, not in the console, since the streams might be reset when globals get cleared, i forget), just do
sys.stdout.errors ='strict'
or, maybe try a different option, depending on whether you want that bit of code executing or not.
It is all probably moot anyway, since you won't be able to call a c extension that wasnt shipped with pythonista.