Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c8cf88

Browse files
committed
Don't die when getuid() or getpid() aren't defined.
1 parent 3df7b5a commit 0c8cf88

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/mimetools.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,14 @@ def choose_boundary():
106106
import socket
107107
import os
108108
hostid = socket.gethostbyname(socket.gethostname())
109-
uid = `os.getuid()`
110-
pid = `os.getpid()`
109+
try:
110+
uid = `os.getuid()`
111+
except:
112+
uid = '1'
113+
try:
114+
pid = `os.getpid()`
115+
except:
116+
pid = '1'
111117
seed = `rand.rand()`
112118
_prefix = hostid + '.' + uid + '.' + pid
113119
timestamp = `int(time.time())`

0 commit comments

Comments
 (0)