Skip to content

Commit

Permalink
Python2 fixes for talking directly to the camera
Browse files Browse the repository at this point in the history
  • Loading branch information
kk7ds committed Feb 14, 2016
1 parent 1116cfe commit 9e20878
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion uvcclient/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def _safe_request(self, *args, **kwargs):
def login(self):
resp = self._safe_request('GET', '/')
headers = dict(resp.getheaders())
self._cookie = headers['Set-Cookie']
try:
self._cookie = headers['Set-Cookie']
except KeyError:
self._cookie = headers['set-cookie']
session = self._cookie.split('=')[1].split(';')[0]

try:
Expand Down
5 changes: 4 additions & 1 deletion uvcclient/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,7 @@ def main():
if not camera:
print('No such camera')
return 1
sys.stdout.buffer.write(do_snapshot(camera))
if hasattr(sys.stdout, 'buffer'):
sys.stdout.buffer.write(do_snapshot(camera))
else:
sys.stdout.write(do_snapshot(camera))

0 comments on commit 9e20878

Please sign in to comment.