https://bugzilla.redhat.com/show_bug.cgi?id=1218023
--- Comment #4 from Mike FABIAN mfabian@redhat.com --- commit 877e6059ceeb667d0a754c7acbcf630c49bbe2e3 Author: Mike FABIAN mfabian@redhat.com Date: Wed May 6 08:26:20 2015 +0200
Use os.path.expanduser('~') instead of os.getenv('HOME')
Resolves: rhbz#1218023 - [abrt] ibus-table: posixpath.py:83:join:TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str' See: https://bugzilla.redhat.com/show_bug.cgi?id=1218023
The Python documentation says:
os.path.expanduser(path)
On Unix and Windows, return the argument with an initial component of ~ or ~user replaced by that user‘s home directory.
On Unix, an initial ~ is replaced by the environment variable HOME if it is set; otherwise the current user’s home directory is looked up in the password directory through the built-in module pwd. An initial ~user is looked up directly in the password directory.
This helps if HOME is not set.
diff --git a/engine/ibus_table_location.py b/engine/ibus_table_location.py index 03dae37..9c5bd67 100644 --- a/engine/ibus_table_location.py +++ b/engine/ibus_table_location.py @@ -64,7 +64,7 @@ def _init(): if not ibus_table_location['data_home'] or not os.path.exists(ibus_table_location['data_home']): ibus_table_location['data_home'] = os.getenv('XDG_DATA_HOME') if not ibus_table_location['data_home'] or not os.path.exists(ibus_table_location['data_home']): - ibus_table_location['data_home'] = os.path.join(os.getenv('HOME'), '.local/share') + ibus_table_location['data_home'] = os.path.expanduser('~/.local/share') ibus_table_location['data_home'] = os.path.join(ibus_table_location['data_home'], 'ibus-table') if not os.access(ibus_table_location['data_home'], os.F_OK): os.makedirs(ibus_table_location['data_home']) @@ -77,7 +77,7 @@ def _init(): if not ibus_table_location['cache_home'] or not os.path.exists(ibus_table_location['cache_home']): ibus_table_location['cache_home'] = os.getenv('XDG_CACHE_HOME') if not ibus_table_location['cache_home'] or not os.path.exists(ibus_table_location['cache_home']): - ibus_table_location['cache_home'] = os.path.join(os.getenv('HOME'), '.cache') + ibus_table_location['cache_home'] = os.path.expanduser('~/.cache') ibus_table_location['cache_home'] = os.path.join(ibus_table_location['cache_home'], 'ibus-table') if not os.access(ibus_table_location['cache_home'], os.F_OK): os.makedirs(ibus_table_location['cache_home'])