[tor-commits] [stem/master] Windows lacks the pwd module

atagar at torproject.org atagar at torproject.org
Sat Nov 9 19:49:35 UTC 2013


commit 13d489c0b38e78cace3ea6758baa65ae7fd31e49
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Nov 9 11:38:42 2013 -0800

    Windows lacks the pwd module
    
    Python's pwd module is only available on Unix platforms. We didn't account for
    this, causing our system module to raise ImportErrors on Windows. Reported by
    realgame on...
    
    https://trac.torproject.org/10072
    
    This regression was introduced by our 1.1.0 release (1.0.1 didn't use pwd), so
    cutting a hotfix release for this fix.
---
 stem/util/system.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index 01eea06..db0943e 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -36,7 +36,6 @@ import ctypes
 import ctypes.util
 import os
 import platform
-import pwd
 import subprocess
 import time
 
@@ -657,6 +656,8 @@ def get_user(pid):
 
   if stem.util.proc.is_available():
     try:
+      import pwd  # only available on unix platforms
+
       uid = stem.util.proc.get_uid(pid)
 
       if uid and uid.isdigit():





More information about the tor-commits mailing list