google-assistant-samsung-smart-tv-integration icon indicating copy to clipboard operation
google-assistant-samsung-smart-tv-integration copied to clipboard

doesn't run on RPI

Open wadoadi opened this issue 6 years ago • 6 comments

I'm trying to run the script (Master branch) on my PI running jessie

Using python samsung-smart-tv-remote.py I get an error due the name in the PY for configparser being that used for python 3 renaming configparser on line 3 and 5 to ConfigParser and adding the () for the prints moves this on to other errors.

python3 samsung-smart-tv-remote.py gives multiple syntax errors e.g. print function needing (), getitem not supported ...

Is this script for a PI!?

wadoadi avatar Dec 20 '17 14:12 wadoadi

Can you try with Python 2?

StancuFlorin avatar Dec 20 '17 14:12 StancuFlorin

With Python 2.7.9 and no changes to the script i get: Traceback (most recent call last): File "samsung-smart-tv-remote.py", line 3, in import configparser, pika, json, time, samsungctl ImportError: No module named configparser

wadoadi avatar Dec 20 '17 15:12 wadoadi

Then changing the configparser to ConfigParser as it appears to be using Python 3 naming "The ConfigParser module has been renamed to configparser in Python 3" but still running under Python 2.x i next get:

Traceback (most recent call last): File "samsung-smart-tv-remote.py", line 8, in params = pika.URLParameters(config['CloudAMQP']['url']) AttributeError: ConfigParser instance has no attribute 'getitem'

wadoadi avatar Dec 20 '17 16:12 wadoadi

I guess something changed in the configparser library. I will try with a fresh setup and I would let you know.

StancuFlorin avatar Dec 20 '17 17:12 StancuFlorin

cool THANK YOU

wadoadi avatar Dec 20 '17 17:12 wadoadi

Almost Working! So here is what I have done so far and the error now seems to be in the JSon Payload! Current error
TypeError: the JSON object must be str, not 'bytes'

Actions thus far:

Install pika and samsungctl for Python 3 with pip3 Install pip3 install pika Install pip3 install samsungctl

Edit samsung-smart-tv-remote.py adding () to each print line

Run the python script using python3 python3 samsung-smart-tv-remote.py

Error on Pi when message is read:

pi@xxxxxx:~/SamsungTV $ python3 samsung-smart-tv-remote.py Traceback (most recent call last): File "samsung-smart-tv-remote.py", line 52, in channel.start_consuming() # start consuming (blocks) File "/usr/local/lib/python3.4/dist-packages/pika/adapters/blocking_connection.py", line 1780, in start_consuming self.connection.process_data_events(time_limit=None) File "/usr/local/lib/python3.4/dist-packages/pika/adapters/blocking_connection.py", line 716, in process_data_events self._dispatch_channel_events() File "/usr/local/lib/python3.4/dist-packages/pika/adapters/blocking_connection.py", line 518, in _dispatch_channel_events impl_channel._get_cookie()._dispatch_events() File "/usr/local/lib/python3.4/dist-packages/pika/adapters/blocking_connection.py", line 1403, in _dispatch_events evt.body) File "samsung-smart-tv-remote.py", line 39, in callback message = json.loads(body) File "/usr/lib/python3.4/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

wadoadi avatar Dec 21 '17 14:12 wadoadi