Closed bmCwmbran closed 6 years ago
Thanks for the report. It looks like you've hit a bit of the code that's not compatible with Python 3. The code was originally written for Python 2.x although the main routines were tested against Python 3 too. The easiest, immediate, solution would be to run your script using Python 2.x.
If you're comfortable, we'd also accept a pull request to make it compatible, but we'd also want to maintain Python 2 compatibility (which can be tricky).
Hi Andrew, Thanks for the really quick reply.
I have no other code to consider so I will try Python 2.x. I will let you know how I get on asap
I changed to Python 2.7 and everything is ok now.
Thanks for the invitation, but as my Python experience is minimal, I won't make a pull request.
FYI @bmCwmbran,
The offending line in evohomeclient2\controlsystem.py
is:
for zone_id, zone_schedule in schedules.iteritems():
This is the only time (grep -rnw '/root/evohome-client'/ -e 'iteritems'
) that iteritems
appears in the entire repository.
I got the code working in python3 by simply changing that line to:
for zone_id, zone_schedule in schedules.items():
All: I may do a PR soon, but I am scared of git (and I have yet to test against python2).
HomeAssistant is Python 3.5, any reason to keep Python 2 compatibility?
@namadori Home assistant is only one use of this library so I'm keen to retain Python 2 compatibility for the other uses. I've just pushed a fix to master which should retain compatibility with both.
Thank you for developing evohome-client. I have little experience in python but the documents are very helpfull. I am using Python 3.5 on Windows 10
If I call ec.zone_schedules_backup('zones.json'), the file jones.json is created as expected. If I then call ec.zone_schedules_restore('zones.json'), an error is reported (see below)
Do I need to modify the contents of zones.json in some way?
Traceback (most recent call last): File "evo.py", line 20, in
ec.zone_schedules_restore('zones.json')
File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\evohomeclient2__init__.py", line 130, in zone_schedules_restore
return self._get_single_heating_system().zone_schedules_restore(filename)
File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\evohomeclient2\controlsystem.py", line 116, in zone_schedules_restore
for zone_id, zone_schedule in schedules.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'