emlid / bluetool

Bluetooth manager for Linux.
GNU General Public License v3.0
48 stars 26 forks source link

Updating to Python 3. #12

Closed shoeffner closed 5 months ago

shoeffner commented 3 years ago

Please refer to #4.

Closes #5. (#4 also includes the tcpbridge-issue).

f1ps1 commented 3 years ago

Cloning your repo and running sudo make install, getting the following error (don't know if that's a critical error or if the script would've ended anyways):

pi@raspberrypi:~/bluetool $ sudo make install
python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to bluetool.egg-info/requires.txt
writing bluetool.egg-info/PKG-INFO
writing top-level names to bluetool.egg-info/top_level.txt
writing dependency_links to bluetool.egg-info/dependency_links.txt
reading manifest file 'bluetool.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bluetool.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/bluetool
copying build/lib.linux-armv7l-2.7/bluetool/blueserver.py -> build/bdist.linux-armv7l/egg/bluetool
copying build/lib.linux-armv7l-2.7/bluetool/agent.py -> build/bdist.linux-armv7l/egg/bluetool
copying build/lib.linux-armv7l-2.7/bluetool/bluezutils.py -> build/bdist.linux-armv7l/egg/bluetool
copying build/lib.linux-armv7l-2.7/bluetool/bluetool.py -> build/bdist.linux-armv7l/egg/bluetool
copying build/lib.linux-armv7l-2.7/bluetool/__init__.py -> build/bdist.linux-armv7l/egg/bluetool
byte-compiling build/bdist.linux-armv7l/egg/bluetool/blueserver.py to blueserver.pyc
byte-compiling build/bdist.linux-armv7l/egg/bluetool/agent.py to agent.pyc
byte-compiling build/bdist.linux-armv7l/egg/bluetool/bluezutils.py to bluezutils.pyc
byte-compiling build/bdist.linux-armv7l/egg/bluetool/bluetool.py to bluetool.pyc
byte-compiling build/bdist.linux-armv7l/egg/bluetool/__init__.py to __init__.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying bluetool.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying bluetool.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying bluetool.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying bluetool.egg-info/requires.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying bluetool.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/bluetool-0.3.0-py2.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing bluetool-0.3.0-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/bluetool-0.3.0-py2.7.egg
Copying bluetool-0.3.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
bluetool 0.3.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/bluetool-0.3.0-py2.7.egg
Processing dependencies for bluetool==0.3.0
Searching for tcpbridge
Reading https://pypi.org/simple/tcpbridge/
Downloading https://files.pythonhosted.org/packages/93/38/f161db29195a295ba0f39c2d3972373ffadc91ae9f6f934e836bfb725f09/tcpbridge-1.1.1-py2-none-any.whl#sha256=397a8f0be256600c4b658dcd3cfb9f00a1c4981aeeec56beeec6653d9a5c740b
Best match: tcpbridge 1.1.1
Processing tcpbridge-1.1.1-py2-none-any.whl
Installing tcpbridge-1.1.1-py2-none-any.whl to /usr/local/lib/python2.7/dist-packages
writing requirements to /usr/local/lib/python2.7/dist-packages/tcpbridge-1.1.1-py2.7.egg/EGG-INFO/requires.txt
Adding tcpbridge 1.1.1 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/tcpbridge-1.1.1-py2.7.egg
Searching for pycairo>=1.11.1
Reading https://pypi.org/simple/pycairo/
Downloading https://files.pythonhosted.org/packages/9d/6e/499d6a6db416eb3cdf0e57762a269908e4ab6638a75a90972afc34885b91/pycairo-1.20.0.tar.gz#sha256=5695a10cb7f9ae0d01f665b56602a845b0a8cb17e2123bfece10c2e58552468c
Best match: pycairo 1.20.0
Processing pycairo-1.20.0.tar.gz
Writing /tmp/easy_install-kXwzBk/pycairo-1.20.0/setup.cfg
Running pycairo-1.20.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-kXwzBk/pycairo-1.20.0/egg-dist-tmp-ZllLvC
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    install_requires=['tcpbridge', 'dbus-python', 'pygobject']
  File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 443, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 685, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 732, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 777, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 782, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-kXwzBk/pycairo-1.20.0/setup.py", line 568, in <module>

  File "/tmp/easy_install-kXwzBk/pycairo-1.20.0/setup.py", line 489, in main

Exception: Python 2 no longer supported
make: *** [Makefile:2: install] Error 1

After running import bluetool in python3, I get the following error:

Traceback (most recent call last):
  File "bt.py", line 1, in <module>
    from bluetool import Bluetooth
  File "/home/pi/.local/lib/python3.7/site-packages/bluetool/__init__.py", line 2, in <module>
    from .blueserver import BluetoothServer
  File "/home/pi/.local/lib/python3.7/site-packages/bluetool/blueserver.py", line 34, in <module>
    from tcpbridge import TCPBridge, SocketSink, TCPBridgeError
  File "/home/pi/.local/lib/python3.7/site-packages/tcpbridge/__init__.py", line 1, in <module>
    from .tcp_bridge import TCPBridge, TCPBridgeError
  File "/home/pi/.local/lib/python3.7/site-packages/tcpbridge/tcp_bridge.py", line 14, in <module>
    from Queue import Queue, Empty
ModuleNotFoundError: No module named 'Queue'

tcpbridge seems to be still running under python2 only

shoeffner commented 3 years ago

About the Python2 error, I have no idea. Did you try to install this using Python 2? This is specifically built for usage with Python3 now.

The latter is because tcpbridge is released without a specific license and each file includes a notice which prohibits distribution, thus I am unable (read: not allowed) to publish my updated version. I left a comment but so far I got no reply: see https://github.com/emlid/bluetool/issues/4#issuecomment-727657268 for details (there is also a comment on how to fix tcpbridge).