diff options
author | Guido van Rossum <guido@python.org> | 1996-08-26 16:40:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-08-26 16:40:20 (GMT) |
commit | 0c8cf888eba5bd54f103453a53e1b1ed7eda9331 (patch) | |
tree | 645b75d88adf24c9a39e310b1bd2949c2f280e53 | |
parent | 3df7b5a5466f6977da8a68d1aec1566b6ae871bb (diff) | |
download | cpython-0c8cf888eba5bd54f103453a53e1b1ed7eda9331.zip cpython-0c8cf888eba5bd54f103453a53e1b1ed7eda9331.tar.gz cpython-0c8cf888eba5bd54f103453a53e1b1ed7eda9331.tar.bz2 |
Don't die when getuid() or getpid() aren't defined.
-rw-r--r-- | Lib/mimetools.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/mimetools.py b/Lib/mimetools.py index da33a77..baf9379 100644 --- a/Lib/mimetools.py +++ b/Lib/mimetools.py @@ -106,8 +106,14 @@ def choose_boundary(): import socket import os hostid = socket.gethostbyname(socket.gethostname()) - uid = `os.getuid()` - pid = `os.getpid()` + try: + uid = `os.getuid()` + except: + uid = '1' + try: + pid = `os.getpid()` + except: + pid = '1' seed = `rand.rand()` _prefix = hostid + '.' + uid + '.' + pid timestamp = `int(time.time())` |