summaryrefslogtreecommitdiffstats
path: root/Lib/mimetools.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-08-26 16:40:20 (GMT)
committerGuido van Rossum <guido@python.org>1996-08-26 16:40:20 (GMT)
commit0c8cf888eba5bd54f103453a53e1b1ed7eda9331 (patch)
tree645b75d88adf24c9a39e310b1bd2949c2f280e53 /Lib/mimetools.py
parent3df7b5a5466f6977da8a68d1aec1566b6ae871bb (diff)
downloadcpython-0c8cf888eba5bd54f103453a53e1b1ed7eda9331.zip
cpython-0c8cf888eba5bd54f103453a53e1b1ed7eda9331.tar.gz
cpython-0c8cf888eba5bd54f103453a53e1b1ed7eda9331.tar.bz2
Don't die when getuid() or getpid() aren't defined.
Diffstat (limited to 'Lib/mimetools.py')
-rw-r--r--Lib/mimetools.py10
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())`