pa1010d-python
pa1010d-python copied to clipboard
Update __init__.py
trafficstars
fix _write_sentence for pyhton3 fix send_command for pyhton3 add missing elements from nmea sentences add initialisation of PA1010D add waitforfix
The missing NMEA sentences are handy, thank you, but I have a few concerns;
- Is the fix to
_write_sentencejust swallowing IOErrors? - This is a lot of logging/error swallowing, what are you trying to achieve here and why?
This level of exception handling is a bit heavy-handed for the underlying library. If you need to catch exceptions in read/write that could be done in the client app.
Generally:
- Your
try/catchshould be around one or two lines of relevant code- as it stands the change of indentation across multiple lines of code makes it near impossible to tell what's actually changed - It's redundant to catch an exception and just raise it again
- It's messy to catch an exception and log it at the library level, makes development iteration more difficult. If a user is concerned with logging they can add that over the top. Maybe a hardened example is the best way to handle this?
- If IO Errors are an intermittent problem in your setup (sometimes it's unavoidable because i2c is the devil) it might be worth having some kind of retry-on-fail, specially for writes
If you'd be happy to strip out all the exception handling for now and make this a clean PR just adding the missing NMEA sentences, we can go from there with some kind of logging example.