Okay, found something worth noting and even though my Python and pdb foo may be weak compared to some of the pythonistas here, this looks like the root cause for the problem at hand.
So I tell Python explicitly to use utf-8 as the I/O encoding, which it obviously refuses. Worse, even, when I try to set it, I get the AttributeError.
However, if I reload the sys module, suddenly the function sys.setdefaultencoding becomes available and after I call it, I can see with
print(sys.getdefaultencoding())
that it was successful.
Obviously, since the PYTHONIOENCODING environment variable is ignored, running this outside the debugger yields the same error as can be seen above. I am investigating possibilities for a workaround, but I reckon the info so far may be valuable, even if I get distracted or bored ;)
Okay, found something worth noting and even though my Python and pdb foo may be weak compared to some of the pythonistas here, this looks like the root cause for the problem at hand.
Observe:
------- ------- ------- ------- -- G=utf-8 python -m pdb $(which bzr) fast-export --plain ~/etc/ python2. 7/dist- packages/ fastimport/ commands. py:333 bzr(19) <module> () getdefaultencod ing()) ncoding( 'utf-8' ) ding' ncoding( 'utf-8' ) getdefaultencod ing()) ------- ------- ------- --
$ PYTHONIOENCODIN
Breakpoint 1 at /usr/lib/
> /usr/bin/
-> from __future__ import absolute_import
(Pdb) import sys; print(sys.
ascii
(Pdb) sys.setdefaulte
*** AttributeError: 'module' object has no attribute 'setdefaultenco
(Pdb) reload(sys)
<module 'sys' (built-in)>
(Pdb) sys.setdefaulte
(Pdb) print(sys.
utf-8
-------
So I tell Python explicitly to use utf-8 as the I/O encoding, which it obviously refuses. Worse, even, when I try to set it, I get the AttributeError.
However, if I reload the sys module, suddenly the function sys.setdefaulte ncoding becomes available and after I call it, I can see with
print( sys.getdefaulte ncoding( ))
that it was successful.
Obviously, since the PYTHONIOENCODING environment variable is ignored, running this outside the debugger yields the same error as can be seen above. I am investigating possibilities for a workaround, but I reckon the info so far may be valuable, even if I get distracted or bored ;)