MorseKOB / PyKOB

Python implementation of a library for Morse and MorseKOB functionality
https://sites.google.com/site/morsekob/morsekob40
MIT License
4 stars 2 forks source link

Added try ... except around attempt to convert wire number with int(.…) in pykob/config.py:764 #238

Closed pwdirks closed 3 years ago

pwdirks commented 3 years ago

Fix seems to only require adding a try ... except guard around the conversion attempt in pykob/configure.py.

pwdirks commented 3 years ago

Hi Ed,

I first defaulted it to “1” but thought about making it “0” as well. I almost changed it but then figured, in case somewhere something decides “0” is not a valid wire number, “1” would be safer. I don’t feel strongly - feel free to change it to default to “0” in another change if you like.

Thanks for merging this pull request.

73, -Patrick.

On Jan 16, 2021, at 10:57 PM, Ed Silky notifications@github.com wrote:

@AESilky commented on this pull request.

In pykob/config.py https://github.com/MorseKOB/PyKOB/pull/238#discussion_r559087819:

  • try:
  • wire = int(_wire)
  • except ValueError as ex:
  • log.err("Wire number value '{}' is not a valid integer value.".format(_wire))
  • wire = 1 Agree. Odd thing is, that I thought I had that - obviously not. Only difference is that I set the wire to 0.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MorseKOB/PyKOB/pull/238#pullrequestreview-569991429, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTAYK455PBULTCTGDQYRP3S2KC7HANCNFSM4WFUZ6FA.

AESilky commented 3 years ago

Only thing is that wire is initialized to 0 when the class is created.

I'm working on the config class as part of 236, so I can change it as part of that. There are a few things that need to be 'fixed' in that class to implement 'observer'.