Variety crashed if user's home directory path contains Unicode characters(variety crashed with UnicodeDecodeError in expanduser(): 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128))

Bug #1642533 reported by 林博仁(Buo-ren, Lin)
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Variety
New
Undecided
Unassigned
variety (Ubuntu)
New
Medium
Unassigned

Bug Description

As title

```
Lin-Buo-Ren@Lin-Buo-Ren-SSD:~$ variety
/usr/lib/python2.7/dist-packages/variety/__init__.py:105: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk, GObject # pylint: disable=E0611
/usr/lib/python2.7/dist-packages/variety/VarietyWindow.py:25: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk, GdkPixbuf, GObject, Gio, Notify # pylint: disable=E0611
/usr/lib/python2.7/dist-packages/variety/AddPanoramioDialog.py:19: PyGIWarning: WebKit was imported without specifying a version first. Use gi.require_version('WebKit', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, WebKit, GObject # pylint: disable=E0611
/usr/lib/python2.7/dist-packages/variety/QuoteWriter.py:19: PyGIWarning: PangoCairo was imported without specifying a version first. Use gi.require_version('PangoCairo', '1.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gdk, Pango, PangoCairo, GdkPixbuf, GObject
/usr/lib/python2.7/dist-packages/variety/indicator.py:28: PyGIWarning: AppIndicator3 was imported without specifying a version first. Use gi.require_version('AppIndicator3', '0.1') before import to ensure that the right version gets loaded.
  from gi.repository import AppIndicator3 # pylint: disable=E0611
Traceback (most recent call last):
  File "/usr/bin/variety", line 39, in <module>
    variety.main()
  File "/usr/lib/python2.7/dist-packages/variety/__init__.py", line 178, in main
    Util.makedirs(os.path.expanduser(u"~/.config/variety/"))
  File "/usr/lib/python2.7/posixpath.py", line 273, in expanduser
    return (userhome + path[i:]) or '/'
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)
Lin-Buo-Ren@Lin-Buo-Ren-SSD:~$ pwd
/home/林博仁
```

ProblemType: Crash
DistroRelease: Ubuntu 16.04
Package: variety 0.6.0-1
ProcVersionSignature: Ubuntu 4.4.0-45.66-generic 4.4.21
Uname: Linux 4.4.0-45-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Nov 17 17:47:16 2016
ExecutablePath: /usr/bin/variety
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/variety
PythonArgs: ['/usr/bin/variety']
SourcePackage: variety
Title: variety crashed with UnicodeDecodeError in expanduser(): 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo vboxusers video

Revision history for this message
林博仁(Buo-ren, Lin) (buo-ren-lin) wrote :
information type: Private → Public
Revision history for this message
James Lu (jlu5) wrote :

Looking at https://bugs.python.org/issue18171, it may be better to replace:

    os.path.expanduser(u"~/.config/variety/")

with

    os.path.expanduser("~/.config/variety/")

However, I haven't tested this myself, so I can't confirm whether it works.

tags: removed: need-duplicate-check
Changed in variety (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.