diff options
| author | Huang Peng <shawn.p.huang@gmail.com> | 2008-08-05 13:51:39 +0800 |
|---|---|---|
| committer | Huang Peng <shawn.p.huang@gmail.com> | 2008-08-05 13:51:39 +0800 |
| commit | b856a258e4d5b9c3d3e7ccf1a0e08ef8dd7d92a6 (patch) | |
| tree | d56d034081117ca946b7c5ddfc257d3f9376ac60 | |
| parent | fff9bf7070374ffb83181fd1590154a4a8090f10 (diff) | |
| download | ibus-b856a258e4d5b9c3d3e7ccf1a0e08ef8dd7d92a6.tar.gz ibus-b856a258e4d5b9c3d3e7ccf1a0e08ef8dd7d92a6.tar.xz ibus-b856a258e4d5b9c3d3e7ccf1a0e08ef8dd7d92a6.zip | |
catch exception throw from os.getlogin().
| -rw-r--r-- | ibus/common.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ibus/common.py b/ibus/common.py index 5934e0c..e0a4561 100644 --- a/ibus/common.py +++ b/ibus/common.py @@ -40,7 +40,11 @@ display = os.environ["DISPLAY"] if "." not in display: display += ".0" -__username = os.getlogin() +__username = None +try: + __username = os.getlogin() +except: + pass if not __username: __username = os.getenv ("LOGNAME") if not __username: @@ -49,6 +53,7 @@ if not __username: __username = os.getenv ("LNAME") if not __username: __username = os.getenv ("USERNAME") + IBUS_ADDR = "unix:path=/tmp/ibus-%s/ibus-%s" % (__username, display.replace(":", "-")) # IBUS_ADDR = "tcp:host=localhost,port=7799" |
