Permalink
Browse files

Merge pull request #1 from troyfarrell/master

Support Python 2.6
  • Loading branch information...
2 parents 149337b + c11b1cc commit 7cc8616c0e6bb6605b3b80f334809ee3cce3447d @Ramblurr committed Jan 23, 2012
Showing with 10 additions and 2 deletions.
  1. +1 −1 README.md
  2. +9 −1 yubi_goog.py
View
@@ -14,7 +14,7 @@ Available under the ISC License.
Prerequisites
-------------
-* Python >=2.7 or 3.x
+* Python >=2.6 or 3.x
* ykchalresp (found in the yubikey-personalization package)
* Yubikey
* [Cross-platform GUI Personalization tool][tool]
View
@@ -104,7 +104,15 @@ def yubi():
cmd.append('ykchalresp')
cmd.append('-2x')
cmd.append(chal)
- resp = subprocess.check_output(cmd).strip()
+ if hasattr(subprocess, "check_output"):
+ resp = subprocess.check_output(cmd).strip()
+ else:
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ out, err = proc.communicate()
+ if not isinstance(out, basestring):
+ raise ValueError("Command {0} returned {1!r}."
+ .format(" ".join(cmd), out))
+ resp = out.strip()
print("OTP: %s" %(mangle_hash(binascii.unhexlify(resp))))
def error():

0 comments on commit 7cc8616

Please sign in to comment.