question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_devices() Typerror: Parser must be a string not NoneType

See original GitHub issue

Hi 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:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kpnobviouscommented, Sep 1, 2021

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!

0reactions
kpnobviouscommented, Sep 1, 2021

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parser must be a string or character stream, not NoneType ...
However, soon as I try to parse the date it results in a TypeError saying that it must be a string or character...
Read more >
typeerror: parser must be a string or character stream, not nonetype ...
TypeError : Parser must be a string or character stream, not NoneType ... following error: File "getreport.py", line 16, in devices = vue.getdevices()...
Read more >
Parser must be a string or character stream, not NoneType ...
Thank you for the attention! My Problem Statement is: Convert .csv file into .ofx file using open source library. My Proposed Solution is: ......
Read more >
bluesky_queueserver.manager.profile_ops — bluesky-queueserver ...
importlib.invalidate_caches() if not os.path.isfile(script_path): raise ... Raises ------ TypeError The element definition is not a string.
Read more >
TypeError: Parser must be a string or character stream, not int
return parser.parse(string_date).date() File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/dateutil/parser.py”, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found