t-wissmann / barpyrus

A python wrapper for lemonbar
Other
33 stars 7 forks source link

TypeError because self.readlines() is None on EOF #14

Closed The-Compiler closed 3 years ago

The-Compiler commented 3 years ago

I just got this when doing hc wmexec:

Traceback (most recent call last):
  File "/usr/bin/barpyrus", line 33, in <module>
    sys.exit(load_entry_point('barpyrus==0.0.0', 'console_scripts', 'barpyrus')())
  File "/usr/lib/python3.8/site-packages/barpyrus/mainloop.py", line 47, in main
    main_loop(bar)
  File "/usr/lib/python3.8/site-packages/barpyrus/mainloop.py", line 95, in main_loop
    x.process()
  File "/usr/lib/python3.8/site-packages/barpyrus/core.py", line 50, in process
    for line in self.readlines():
TypeError: 'NoneType' object is not iterable

This seems to happen because:

https://github.com/t-wissmann/barpyrus/blob/73e094e4adbeebe9b800d9e866eab76743a32dc3/barpyrus/core.py#L38-L42

but the None return value isn't actually handled:

https://github.com/t-wissmann/barpyrus/blob/73e094e4adbeebe9b800d9e866eab76743a32dc3/barpyrus/core.py#L49-L51

Not sure what the proper fix would be though - should it return [] instead?

t-wissmann commented 3 years ago

Probably exiting is the best behaviour (the same traceback should also appear when quitting hlwm)

t-wissmann commented 3 years ago

Fixed by #15