diff --git a/tryton/common/common.py b/tryton/common/common.py index 9090dcc54a..4f7d30dab3 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -265,7 +265,8 @@ def file_open(filename, type, parent, print_p=False): # Try without operation, it is not supported on version < 2.5 os.startfile(os.path.normpath(filename)) return - elif os.name == 'mac' or os.uname()[0] == 'Darwin': + elif os.name == 'mac' or \ + (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): pid = os.fork() if not pid: pid = os.fork() diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 5d38ddfad3..d5b3db8d81 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -183,7 +183,8 @@ class Main(object): self.sig_mode() - if os.name in ('nt', 'mac') or os.uname()[0] == 'Darwin': + if os.name in ('nt', 'mac') or \ + (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): # Disable actions, on win32 we use os.startfile # and on mac we use /usr/bin/open self.menuitem_actions.set_sensitive(False) diff --git a/tryton/translate.py b/tryton/translate.py index 543ee858b4..8b91dd06fe 100644 --- a/tryton/translate.py +++ b/tryton/translate.py @@ -169,7 +169,8 @@ def setlang(lang=None, locale_dict=None): if os.name == 'nt': lang2 = _LOCALE2WIN32.get(lang, lang) os.environ['LANG'] = lang - elif os.name == 'mac' or os.uname()[0] == 'Darwin': + elif os.name == 'mac' or \ + (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): encoding = 'UTF-8' locale.setlocale(locale.LC_ALL, str(lang2 + '.' + encoding)) except: