get_devices() Typerror: Parser must be a string not NoneType
See original GitHub issueHi all,
I updated to latest package to solve auth issues but I am now having a date parsing issue when doing the following:
with open('keys.json') as f:
data = json.load(f)
vue = em.PyEmVue()
token_storage_file='keys.json')
vue.login(id_token=data['idToken'],
access_token=data['accessToken'],
refresh_token=data['refreshToken'],
token_storage_file='keys.json')
devices = vue.get_devices()
for device in devices:
device = vue.populate_device_properties(device)
print(device.device_name)
I get the following error: File “get_report.py”, line 16, in <module> devices = vue.get_devices() File “/env/lib/python3.9/site-packages/pyemvue/pyemvue.py”, line 59, in get_devices devices.append(VueDevice().from_json_dictionary(dev)) File “/env/lib/python3.9/site-packages/pyemvue/device.py”, line 68, in from_json_dictionary if ‘offlineSince’ in con: self.offline_since = parse(con[‘offlineSince’]) File “env/lib/python3.9/site-packages/dateutil/parser/_parser.py”, line 1374, in parse return DEFAULTPARSER.parse(timestr, **kwargs) File “/env/lib/python3.9/site-packages/dateutil/parser/_parser.py”, line 646, in parse res, skipped_tokens = self._parse(timestr, **kwargs) File “env/lib/python3.9/site-packages/dateutil/parser/_parser.py”, line 725, in _parse l = _timelex.split(timestr) # Splits the timestr into tokens File “env/lib/python3.9/site-packages/dateutil/parser/_parser.py”, line 207, in split return list(cls(s)) File “env/lib/python3.9/site-packages/dateutil/parser/_parser.py”, line 75, in init raise TypeError('Parser must be a string or character stream, not ’ TypeError: Parser must be a string or character stream, not NoneType
Thanks for your help.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
FYI, this was totally my issue. even though i updated pyemvue via git, and ran pip3 install pyemvue, it didn’t update the local cache so that was still on vs 0.14.1. I had to add in the --upgrade command. No issues after that!
so interesting, i updated a basic test script that would pull the last 7 days of total usage ad added this for loop to print devices: for device in devices: device = vue.populate_device_properties(device) print(device.device_name)
When running just that, it outputs this: Home Home Plug Dehumidifier
The last 2 are smart plugs
When vuegraf runs to get usage data, it errors out here populateDevices(account) Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “src/vuegraf.py”, line 66, in populateDevices devices = account[‘vue’].get_devices() File “/home/pi/.local/lib/python3.7/site-packages/pyemvue/pyemvue.py”, line 59, in get_devices devices.append(VueDevice().from_json_dictionary(dev)) File “/home/pi/.local/lib/python3.7/site-packages/pyemvue/device.py”, line 68, in from_json_dictionary if ‘offlineSince’ in con: self.offline_since = parse(con[‘offlineSince’]) File “/home/pi/.local/lib/python3.7/site-packages/dateutil/parser/_parser.py”, line 1356, in parse return DEFAULTPARSER.parse(timestr, **kwargs) File “/home/pi/.local/lib/python3.7/site-packages/dateutil/parser/_parser.py”, line 645, in parse res, skipped_tokens = self._parse(timestr, **kwargs) File “/home/pi/.local/lib/python3.7/site-packages/dateutil/parser/_parser.py”, line 721, in _parse l = _timelex.split(timestr) # Splits the timestr into tokens File “/home/pi/.local/lib/python3.7/site-packages/dateutil/parser/_parser.py”, line 207, in split return list(cls(s)) File “/home/pi/.local/lib/python3.7/site-packages/dateutil/parser/_parser.py”, line 76, in init ‘{itype}’.format(itype=instream.class.name)) TypeError: Parser must be a string or character stream, not NoneType
both plugs are showing on in the app and reporting usage.
when i updated i just did git pull and it updated teh source, maybe the python packaged is still cached?