[tor-commits] [stem/master] Stacktrace when calling is_running with python3

atagar at torproject.org atagar at torproject.org
Sat Nov 4 18:53:38 UTC 2017


commit 4052c49809dfd6389423d8d1bd8f8792bd9fbde7
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Nov 4 11:35:21 2017 -0700

    Stacktrace when calling is_running with python3
    
    Recent change broke is_running for python3...
    
      ======================================================================
      ERROR: test_is_running_by_name
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/require.py", line 58, in wrapped
          return func(self, *args, **kwargs)
        File "/home/atagar/Desktop/stem/test/integ/util/system.py", line 144, in test_is_running_by_name
          self.assertTrue(stem.util.system.is_running(tor_cmd) or stem.util.system.is_running('tor.real'))
        File "/home/atagar/Desktop/stem/stem/util/system.py", line 449, in is_running
          if isinstance(command, (bytes, unicode)):
      NameError: global name 'unicode' is not defined
---
 stem/util/system.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index 459cde4a..8de186b1 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -444,9 +444,9 @@ def is_running(command):
       command_listing = call(secondary_resolver, None)
 
     if command_listing:
-      command_listing = map(str_type.strip, command_listing)
+      command_listing = [c.strip() for c in command_listing]
 
-      if isinstance(command, (bytes, unicode)):
+      if isinstance(command, (bytes, str_type)):
         command = [command]
 
       for cmd in command:





More information about the tor-commits mailing list