gateway
gateway copied to clipboard
Decoder missing on armhf
Describe the bug Starting TheengsGatewaay on armhf platform ends with an error stated below.
File "/usr/local/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/local/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/local/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/opt/venv/lib/python3.9/site-packages/TheengsGateway/__init__.py", line 26, in <module>
from .ble_gateway import run
File "/opt/venv/lib/python3.9/site-packages/TheengsGateway/ble_gateway.py", line 35, in <module>
from ._decoder import decodeBLE, getProperties, getAttribute
ModuleNotFoundError: No module named 'TheengsGateway._decoder'
File exists as filename _decoder.cpython-39-arm-linux-gnueabihf.so but somehow fails to load it.
Replicated on RPi3B+ and RPi 1 B+. Have any ideas?
To Reproduce Steps to reproduce the behavior:
- Start gateway with predefined json
{
"host": ”192.168.0.200”
"pass": "",
"user": "",
"port": 1883,
"publish_topic": "home/TheengsGateway/BTtoMQTT",
"subscribe_topic": "home/TheengsGateway/commands",
"publish_all": true,
"ble_scan_time": 60,
"ble_time_between_scans": 60,
"log_level": "DEBUG",
"discovery": true,
"discovery_topic": "homeassistant/sensor",
"discovery_device_name": "TheengsGateway",
"discovery_filter": "[IBEACON,GAEN,MS-CDP]",
"scanning_mode": "active",
"adapter": "hci0"
}
Expected behavior It shouldn't crash
Screenshots
Environment (please complete the following information):
- version used: V0.5.0
- Context of your project
Additional context This is inside docker image. Seems to fail even though multiple images (for different platforms) were built the same way. Also. Tested on two different devices, leads to same issue.
Hello,
Do you have the same error with v0.4.0 ?
Haven't checked honestly, but tried it now and yes. Same error, only on armv6. However do keep in mind that this was all built inside docker image. But still, seems to work fine with armv7, arm64 (and x86 platforms ofcourse) but apparently not armv6.
Not sure how to approach this issue.
Also, when i went into lib folder where TheengsGateway is installed, i tried importing _decoder manually, it failed
root@c8ad9940200b:/opt/venv/lib/python3.9/site-packages/TheengsGateway# ls -l
total 156
-rw-r--r-- 1 root root 5333 Sep 11 19:57 __init__.py
drwxr-xr-x 2 root root 4096 Sep 11 19:57 __pycache__
-rw-r--r-- 1 root root 129236 Sep 11 19:57 _decoder.cpython-39-arm-linux-gnueabihf.so
-rw-r--r-- 1 root root 7855 Sep 11 19:57 ble_gateway.py
-rw-r--r-- 1 root root 4940 Sep 11 19:57 discovery.py
root@c8ad9940200b:/opt/venv/lib/python3.9/site-packages/TheengsGateway# python3
Python 3.9.14 (main, Sep 7 2022, 22:10:05)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _decoder
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '_decoder'
However on armv7, works fine
(venv) root@16166ea251e2:/opt/venv/lib/python3.9/site-packages/TheengsGateway# ls -l
total 156
-rw-r--r-- 1 root root 5333 Sep 11 19:54 __init__.py
drwxr-xr-x 2 root root 4096 Sep 11 19:54 __pycache__
-rw-r--r-- 1 root root 129236 Sep 11 19:54 _decoder.cpython-39-arm-linux-gnueabihf.so
-rw-r--r-- 1 root root 7855 Sep 11 19:54 ble_gateway.py
-rw-r--r-- 1 root root 4940 Sep 11 19:54 discovery.py
(venv) root@16166ea251e2:/opt/venv/lib/python3.9/site-packages/TheengsGateway# python3
Python 3.9.14 (main, Sep 8 2022, 00:47:15)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _decoder
>>> _decoder.__dir__()
['__name__', '__doc__', '__package__', '__loader__', '__spec__', 'decodeBLE', 'getAttribute', 'getProperties', '__file__']
Honestly extremely strange.
I'm seeing the same thing on latest docker image.
Is this still happening with decoder now being built and distributed as a separate Python package on PyPI?