b3b / able

Python for Android Bluetooth Low Energy package
MIT License
38 stars 18 forks source link

ImportError: cannot import name 'BluetoothDispatcher' from 'able' #18

Closed Enkumicahel closed 3 years ago

Enkumicahel commented 3 years ago

Hello,

Using Buildozer to build my Kivy app with the ABLE library, but after following every instruction given in here, I get this at the end of the Bulldozer log.

python : ImportError: cannot import name 'BluetoothDispatcher' from 'able' (/data/user/0/org.test.bleable/files/app/_python_bundle/site-packages/able/init.pyc)

I have already included the following in my buildozer.spec file: requirements = python3,kivy,android,able,lictionary,tatsu p4a.local_recipes = ../recipes

what am I missing?

b3b commented 3 years ago

Hello,

Line p4a.local_recipes = ../recipes assumes that that there is recipes directory one level above the build directory. It could be checked by running ls ../recipes/able/ from the build directory.

Seems like in your case this directory was missed. But, PyPi has package with the name able - non related to this library. And this package was installed instead.

To fix the issue, you can change p4a.local_recipes to point to the directory with the able recipe.

Enkumicahel commented 3 years ago

I thought so, but I tried to import the non-related PyPi able package to check if it exists but, it doesn't exist.

as for the ls ../recipes/able/ it returns the contents of the directory

To fix the issue, you can change p4a.local_recipes to point to the directory with the able recipe.

already done that.

b3b commented 3 years ago

lictionary,tatsu in requirements are PyPi package dependencies, so this library was involved.

One more way to check that wrong library was used, is by checking the output of the ls ./.buildozer/android/platform/*/dists/*/_python_bundle/_python_bundle/site-packages/able In case of able-recipe this directory contains android, and in case of PyPi library it contains grammar.ebnf.

Maybe running buildozer android clean before the next building attempt will help.

Enkumicahel commented 3 years ago

I think I am on the same page as you have mentioned above. But, now I was able to take the java interface and GATT implementation code and redesign my code to directly interact with that. So, I am good to go. Thank you!