Don't die when getuid() or getpid() aren't defined.

This commit is contained in:
Guido van Rossum 1996-08-26 16:40:20 +00:00
parent 3df7b5a546
commit 0c8cf888eb

View file

@ -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())`