Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Commit

Permalink
fixed event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealLink committed Apr 18, 2016
1 parent c5f41af commit 88a0c67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions pylgtv/webos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def __init__(self, ip):
self.command_count = 0
self.last_response = None

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

self.load_key_file()

@staticmethod
Expand Down Expand Up @@ -115,7 +112,9 @@ def _register(self):

def register(self):
"""Pair client with tv."""
asyncio.get_event_loop().run_until_complete(self._register())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(self._register())

@asyncio.coroutine
def _command(self, msg):
Expand Down Expand Up @@ -153,7 +152,9 @@ def command(self, request_type, uri, payload):
}

self.last_response = None
asyncio.get_event_loop().run_until_complete(self._command(message))
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(self._command(message))

def request(self, uri, payload=None):
"""Send a request."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='pylgtv',
version='0.1.0',
version='0.1.1',
description='Library to control webOS based LG Tv devices',
url='https://github.com/TheRealLink/pylgtv',
author='Dennis Karpienski',
Expand Down

0 comments on commit 88a0c67

Please sign in to comment.