Closed dwalton76 closed 7 years ago
@rhempel if you can point me in the right direction on how this should work I can look at this one
Is this using the latest (untagged) version of the binding in the develop
branch?
yes
OK, I'll look at adding a Button()
unit test set (I need to do this anyways, and figure out what's going on. I think that somewhere around 2118 and 2112 is where to start looking :-)
Most likely the issue is the way the Button instance is instatiated - and as I recall that part of the binding is hand-generated.
Looks like the problem was introduced in #162. The Button
class is derived from Device
and uses _file_cache
which was removed in #162.
Hmmm, I thought I had removed all the uses of _file_cache - either I did not or I clobbered a merge somewhere. Either way, a test suite for Buttons() is next in line to get done, and then fixing the code should allow the tests to pass,
Unit test case created and failing (good) - code fix should arrive tomorrow ... I certainly removed the first instance of the _file_cache but did not complete the task
I finally got this done - the current https://github.com/rhempel/ev3dev-lang-python/tree/develop branch has the most up to date code - feel free to test and provide feedback
Newbie here: how can I apply the fix to my brick?
Thanks for checking to see if this is an existing issue :-) If you are comfortable with the command line and you are using Python2, you can replace the file at /usr/lib/python2.7/dist-packages/ev3dev/ev3.py
with the one from the current https://github.com/rhempel/ev3dev-lang-python/tree/develop branch. If you're using Python3 - it's more complicated and you have to fix a .egg
file.
I am working on fixing a few things in the Python API (still) and plan to release something soon (can't be more specific than that - sorry)
If egg files are a zip file, can i just unzip it, change the code and zip it again? (python3) Thanks
I think so - or you can do what I did which is rename the egg file to some other extension and link the Python 3 library folder to the Python 2 library
But I was not sure how comfortable you were doing any of this :-)
Thanks! I deleted the python 3 egg file, and copied the python 2 version to 3, and then patched the file.
sudo python setup.py install
Is worth a try
File "./rubiks.py", line 47, in init self.buttons = Button() File "build/bdist.linux-armv5tejl/egg/ev3dev/core.py", line 2118, in init File "build/bdist.linux-armv5tejl/egg/ev3dev/core.py", line 2122, in _button_file