Bug 374657

Summary: Non-ascii home directory causes kajongg to crash during startup (again)
Product: [Applications] kajongg Reporter: Göran Uddeborg <goeran>
Component: generalAssignee: Wolfgang Rohdewald <wolfgang>
Status: RESOLVED FIXED    
Severity: normal CC: kde-games-bugs-null
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 16.12.1
Sentry Crash Report:

Description Göran Uddeborg 2017-01-06 21:07:05 UTC
It seems bug 322606 has returned.

When I try to start kajongg, it ends immediately with a Python traceback, complaining about a UnicodeEncodeError.  If I change the HOME environment variable to some pure ASCII path, it works.  To reproduce see below.  The first invocation of kajongg comes up with a window, while the second one fails as can be seen.

This is on a Fedora 25 system with kajongg-16.08.3-1.fc25.noarch.

[göran@mimmi ~]$ mkdir /tmp/göran /tmp/goeran
[göran@mimmi ~]$ HOME=/tmp/goeran kajongg
[göran@mimmi ~]$ HOME=/tmp/göran kajongg
Traceback (most recent call last):
  File "/usr/bin/kajongg", line 172, in <module>
    parseOptions()
  File "/usr/bin/kajongg", line 147, in parseOptions
    if not initDb():
  File "/usr/share/kde4/apps/kajongg/query.py", line 283, in initDb
    PrepareDB(DBHandle.dbPath())  # create or upgrade
  File "/usr/share/kde4/apps/kajongg/query.py", line 161, in dbPath
    return Options.dbPath if Options.dbPath else appdataDir() + name
  File "/usr/share/kde4/apps/kajongg/kde.py", line 94, in appdataDir
    unicode(KGlobal.dirs().locateLocal("appdata", ""))) + '/'
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128)
Comment 1 Wolfgang Rohdewald 2017-01-06 22:20:21 UTC
Git commit cb7f4bfe112355c0a48a4be59d1395cda78c1a6e by Wolfgang Rohdewald.
Committed on 06/01/2017 at 22:13.
Pushed by wrohdewald into branch 'Applications/16.12'.

Fix unicode encoding error again.

There may be more bugs like this but I do not really want to spend
much time testing everything - with current master (becoming
Applications/17.04) support for python2 is removed, and many
potential pitfalls with it, so for me this is only legacy code.

So I will just fix things when they come up.
FIXED-IN: 16.12.1

M  +3    -3    src/kde.py

https://commits.kde.org/kajongg/cb7f4bfe112355c0a48a4be59d1395cda78c1a6e
Comment 2 Göran Uddeborg 2017-01-07 11:14:37 UTC
So you're migrating to Python 3.  Nice.  Python 3 certainly reduces the encoding issues with Python 2 significantly!

Inspired by your comment, I made a try to simply run my kajongg version with Python 3, to see if the Fedora fix could be as simple as modifying the shebang line and adjusting the RPM dependencies.  It wasn't quite that easy, unfortunately.  The Python 3 version of Twisted, at least the Fedora packaging, doesn't provide any twisted.spread module which is apparently used.

But maybe 16.08.3 just wasn't ready for Python 3.  I guess it isn't worth it to debug this too much with t he old version of kajongg.

Thanks for a quick fix!