Menu

#8 remaining python2-isms

v 0.6
closed
None
5
2014-07-25
2014-07-23
No

There are a couple of python2-isms still in the code.

Please pull from git://git.smurf.noris.de/pyst.git ("master" branch)

I also updated the Debian packaging; pull from my "debian" branch if you also want that.

diff --git a/asterisk/agi.py b/asterisk/agi.py
index 30d7e27..57683f7 100644
--- a/asterisk/agi.py
+++ b/asterisk/agi.py
@@ -79,7 +79,7 @@ class AGI:
             key,data = line.split(':')[0], ':'.join(line.split(':')[1:])
             key = key.strip()
             data = data.strip()
-            if key <> '':
+            if key != '':
                 self.env[key] = data
         self.stderr.write('class AGI: self.env = ')
         self.stderr.write(pprint.pformat(self.env))
@@ -103,7 +103,7 @@ class AGI:
         try:
             self.send_command(command, *args)
             return self.get_result()
-        except IOError,e:
+        except IOError as e:
             if e.errno == 32:
                 # Broken Pipe * let us go
                 raise AGISIGPIPEHangup("Received SIGPIPE")
diff --git a/asterisk/agitb.py b/asterisk/agitb.py
index f13c76f..a39ffd9 100644
--- a/asterisk/agitb.py
+++ b/asterisk/agitb.py
@@ -75,9 +75,10 @@ def scanvars(reader, frame, locals):
     return vars

-def text((etype, evalue, etb), context=5):
+def text(exc, context=5):
     """Return a plain text document describing a given traceback."""
     import os, types, time, traceback, linecache, inspect, pydoc
+    (etype, evalue, etb) = exc

     if type(etype) is types.ClassType:
         etype = etype.__name__

Discussion

  • Ralf Schlatterbeck

    Pulled, thanks for noticing and taking the time to report!
    I've also pulled your debian branch.

    I'm still not daring to release the new code: I'd really like to stay encoding-agnostic, so I don't want to asume the encoding used by asterisk is utf-8 -- but there currently is no way to do this in python... unless I'm missing something.

     
  • Ralf Schlatterbeck

    • status: open --> closed
    • assigned_to: Ralf Schlatterbeck
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.