Comment 4 for bug 1281084

Revision history for this message
Václav Šmilauer (eudoxos) wrote : Re: UnicodeDecodeError in is_closing_session

Just looking at the approt source, in is_closing_session, the error is here:

with open('/proc/%s/environ' % pid) as e:
        env = e.read().split('\0')

This is normally not a problem with python3, but apport runs for some reason with the ascii encoding, which will fail when reading utf-8 encoded environment variable (in my case, it is "DEBFULLNAME=Václav Šmilauer"). So the fix is perhaps

with open('/proc/%s/environ' % pid, encoding='utf-8') as e:
        env = e.read().split('\0')

(that's what I did locally) or open the file with 'rb' and work on bytes object rather than str.