supersaiyanmode/PyWebOSTV

Empty app.list_apps() after init of a 2nd client.

kilian579 opened this issue · 2 comments

So I tried to create a client discarding it and creating a second client.

client = WebOSClient(ip)
client.connect()


client2 = WebOSClient(ip)
client2.connect()

The second client will connect to the TV, it is able to send commands, but the list of apps from

app = ApplicationControl(client)
apps = app.list_apps()

will be empty, so starting an app from there won't work.

Traceback (most recent call last):
File "webos_testsheet.py", line 138, in
controlPrompt(client2)
File "webos_testsheet.py", line 41, in controlPrompt
apps = app.list_apps()
File "C:\Users\vvvbb\Dropbox\Dinter\SmartTv\src\pywebostv\controls.py", line 117, in request_func
status, message = response_valid(payload)
File "C:\Users\vvvbb\Dropbox\Dinter\SmartTv\src\pywebostv\controls.py", line 44, in standard_validation
if not payload.pop("returnValue"):
KeyError: 'returnValue'

On other tries i just got an empty list and a NoneType Error

I thought that was fixed in this commit: 8e4e3f1. Are you using the latest version?

On closer reading I see standard_validation in your stacktrace. IIRC, that came after that commit -- this is weird. Can I perhaps suggest logging the payload in the standard_validation(..) and pasting the response here?

Also, I see one potential issue: We need to change payload.pop("returnValue") -> payload.pop("returnValue", None). Would you want to send a PR seeing as you surfaced it?