alexmohr / sonyapilib

Contains a python api to control sony devices.
MIT License
20 stars 11 forks source link

SyntaxError "name: str" #27

Closed dilruacs closed 5 years ago

dilruacs commented 5 years ago
2019-04-04 19:35:21 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform sony
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sony/media_player.py", line 63, in setup_platform
    from sonyapilib.device import SonyDevice
  File "/srv/homeassistant/lib/python3.5/site-packages/sonyapilib/device.py", line 49
    name: str
        ^
SyntaxError: invalid syntax

https://github.com/alexmohr/sonyapilib/blob/f9fa0ce526aff3661b67d2cd7d96d36d7f334ae4/sonyapilib/device.py#L49

dilruacs commented 5 years ago

Home Assistant should work on Python 3.5 according to its installation manual: https://www.home-assistant.io/docs/installation/

From what I find, "type hints" are a feature that is added in Python 3.5

alexmohr commented 5 years ago

I'm going to change this and I'll change the travis settings to python 3.5.

dilruacs commented 5 years ago

What is puzzling me is that I have 3.5 installed (see stacktrace)

(homeassistant) homeassistant@hass:~$ python --version
Python 3.5.3
alexmohr commented 5 years ago

Fixed in 8cc8420 Maybe @schoenpat has a better idea how to solve this :)

schoenpat commented 5 years ago

@dilruacs i think this feature was added in 3.6, not in 3.5

with "type hints" you probably mean this https://docs.python.org/3/library/typing.html