bitrate16 / peripage-python

Python module and documentation for direct printing on Peripage thermal printers via bluetooth
GNU General Public License v3.0
77 stars 10 forks source link

Error when running CLI tool with python 3.10 #9

Closed superkartoffel closed 1 year ago

superkartoffel commented 1 year ago

When I run the CLI-tool on an up-to-date Arch Linux machine, I get the following error:

$ python -m ppa6 -m 00:15:83:FA:9A:XX -t "Test Message"
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/kartoffel/.local/lib/python3.10/site-packages/ppa6/__main__.py", line 131, in <module>
    main()
  File "/home/kartoffel/.local/lib/python3.10/site-packages/ppa6/__main__.py", line 76, in main
    printer.setConcentration(args.concentration)
  File "/home/kartoffel/.local/lib/python3.10/site-packages/ppa6/__init__.py", line 391, in setConcentration
    self.tellPrinter(bytes.fromhex(opcode))
  File "/home/kartoffel/.local/lib/python3.10/site-packages/ppa6/__init__.py", line 145, in tellPrinter
    self.sock.send(byteseq)
  File "<string>", line 3, in send
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

I'm not a python expert, but a quick google tells me that something changed in python 3.10 that might cause this error.

$ python --version
Python 3.10.8
bitrate16 commented 1 year ago

@superkartoffel Related to pyblyez https://stackoverflow.com/a/71101727 https://github.com/pybluez/pybluez/issues/426

Try upgrading pybluez pip install git+https://github.com/pybluez/pybluez

superkartoffel commented 1 year ago

My bad. Thanks for helping me out. The git version of pybluez actually solves the issue.

I hope they do a release of the fixed version soon. Last release is from 2019?! Actually, it looks like pybluez from the arch repos is not usable with the python version from the repos. I'll try to find out where to report that to.