After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324323 - "import gtk" changes sys.getdefaultencoding()
"import gtk" changes sys.getdefaultencoding()
Status: RESOLVED DUPLICATE of bug 132040
Product: pygtk
Classification: Bindings
Component: general
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2005-12-17 10:43 UTC by Sebastien Bacher
Modified: 2005-12-17 10:51 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14



Description Sebastien Bacher 2005-12-17 10:43:21 UTC
Thos bug has been opened here: http://bugzilla.ubuntu.com/show_bug.cgi?id=21024

">>> import sys
>>> print sys.getdefaultencoding()
'ascii'
>>> import gtk
>>> print sys.getdefaultencoding()
'utf-8'

This is bad.  It is generally a bad idea for a library to change global state
that may break other libraries; it's worse that it does this as a side-effect of
merely being imported.  sys.setdefaultencoding is also generally considered a
misfeature by the Python developers, and changing the default encoding from
'ascii' (except perhaps to 'undefined') is asking for potential bugs to be
hidden, rather than raising exceptions when you'd expect.  There's a reason
sys.setdefaultencoding is not accessible by default."
Comment 1 Johan (not receiving bugmail) Dahlin 2005-12-17 10:51:16 UTC

*** This bug has been marked as a duplicate of 132040 ***