Open cnobile2012 opened 2 years ago
How did you install the library? Using the install via setup.py does not work (Probably a victim when the Ryanteck code was moved to PiSupply). I just tried with pip on my Mac (python 3.9.1 from homebrew) and it works fine. No import error.
Regarding exit(). Yes, it is not recommended, better to take your proposed approach. I am not the maintainer for the Ryanteck code, nor working for PiSupply, hence I cannot guarantee that it will be fixed.
Thanks for your response. I also used pip to install it in a Python virtual environment. As it turns out this repo is no longer active. To find the active repo go to https://bitbucket.org/ryanteckltd/rtk-gpio-python-side/src/master/.
What I did was to copy the code from the pip install and fix the code myself, expecting that the code will never be maintained even in the newer Bitbucket repo. I may eventually push my fixes to my GitHub account if I decide to do anything other than a few bug fixes. There is little support for a lot of features the board can do, but the software cannot do.
I often find that hardware people are not good at writing good professional code with proper unit testing, this is another example of that problem.
I'm using Python 3.8.10. I get the following traceback.
There are two issues in that traceback.
sys
package. I doubt this function is even needed since it would only be needed in a script run on the command line. This is a library, not a script. Add anelse
after theif(rtkGPIOPort == ""):
and put everything after that in theelse
, then removing the exit() will just fall through and do nothing. Then in theRTk/GPIO.py
file put atry/except AttributeError
block around theinstance = protocol.GPIOClient(adaptors.SerialAdaptor(rtkserial.s), DEBUG)
statement and put everything else in anelse
clause.I also found that there are tabs used in the code which go against PEP8 the Python programming style guide.
I've been developing python code for over 20 years, so I know these are real issues.