Open DanielHeath opened 4 years ago
Aha!
The pybluez dependency dropped python2 support in https://github.com/pybluez/pybluez/commit/40f627d2306596bfe8f3494a87e3b501bfa55464 but this library does not yet work with python3.
I could install btproxy for python2.7 with PyBluez version 0.22 instead of the latest version 0.23.
Replacing https://github.com/conorpp/btproxy/blob/master/lib/btproxy_clone.c#L118
with
#if PY_MAJOR_VERSION >= 3
at least makes btproxy
run on my machine
Can confirm it works on my end too with python 3.9
On Ubuntu I tried python 2.7 and 3.9. Both give me above errors as DanielHeath stated. I replaced: #if defined PYTHON34 || defined PYTHON340 with: #if PY_MAJOR_VERSION >= 3 before sudo python setup.py install But no fix. Any suggestions?
Edit: Installed pip2 and version 0.22 of pybluez: sudo pip2 install pybluez==0.22 and then btproxy does run.
Edit: But btproxy runs, but no result, and when I close it:
Running proxy on master xx:xx:xx:xx:xx:xx and slave yy:yy:yy:yy:yy:yy
^CTraceback (most recent call last):
File "/usr/local/bin/btproxy", line 4, in <module>
__import__('pkg_resources').run_script('btproxy==0.1', 'btproxy')
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1462, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/btproxy", line 39, in <module>
btproxy.mitm()
File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/mitm.py", line 503, in mitm
self.setup_adapters()
File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/mitm.py", line 410, in setup_adapters
restart_bluetoothd()
File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/adapter.py", line 19, in restart_bluetoothd
_run(['replace_bluetoothd'])
File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/adapter.py", line 13, in _run
return subprocess.check_output(cmd)
File "/usr/lib/python2.7/subprocess.py", line 217, in check_output
output, unused_err = process.communicate()
File "/usr/lib/python2.7/subprocess.py", line 475, in communicate
stdout = _eintr_retry_call(self.stdout.read)
File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
return func(*args)
Can confirm it works on my end too with python 3.9
What do you have operating system?
On Ubuntu I tried python 2.7 and 3.9. Both give me above errors as DanielHeath stated.
I replaced: #if defined PYTHON34 || defined PYTHON340 with: #if PY_MAJOR_VERSION >= 3
before sudo python setup.py install
But no fix.
Any suggestions?
Edit:
Installed pip2 and version 0.22 of pybluez:
sudo pip2 install pybluez==0.22
and then btproxy does run.
Edit:
But btproxy runs, but no result, and when I close it:
Running proxy on master xx:xx:xx:xx:xx:xx and slave yy:yy:yy:yy:yy:yy ^CTraceback (most recent call last): File "/usr/local/bin/btproxy", line 4, in <module> __import__('pkg_resources').run_script('btproxy==0.1', 'btproxy') File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 666, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1462, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/btproxy", line 39, in <module> btproxy.mitm() File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/mitm.py", line 503, in mitm self.setup_adapters() File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/mitm.py", line 410, in setup_adapters restart_bluetoothd() File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/adapter.py", line 19, in restart_bluetoothd _run(['replace_bluetoothd']) File "/usr/local/lib/python2.7/dist-packages/btproxy-0.1-py2.7-linux-x86_64.egg/libbtproxy/adapter.py", line 13, in _run return subprocess.check_output(cmd) File "/usr/lib/python2.7/subprocess.py", line 217, in check_output output, unused_err = process.communicate() File "/usr/lib/python2.7/subprocess.py", line 475, in communicate stdout = _eintr_retry_call(self.stdout.read) File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call return func(*args)
У вас сейчас получилось?
Replacing https://github.com/conorpp/btproxy/blob/master/lib/btproxy_clone.c#L118 with
#if PY_MAJOR_VERSION >= 3
at least makesbtproxy
run on my machine
If you don't want to edit the c file, you can also define a macro in btproxy/setup.py
git clone https://github.com/conorpp/btproxy
sed -i "12a\ \ \ \ define_macros=[('PYTHON34', 'true')]," btproxy/setup.py
cd btproxy
sudo python3 setup.py install
With python2:
With python3: