Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluez error when trying to connect to printer #80

Closed
LuscanoDev opened this issue Feb 1, 2025 · 1 comment
Closed

bluez error when trying to connect to printer #80

LuscanoDev opened this issue Feb 1, 2025 · 1 comment

Comments

@LuscanoDev
Copy link

I got this error sometimes when i try to print something, i already tried restarting bluetooth service

⏳ Applying Floyd-Steinberg dithering to image...
✅ Done.
✅ Read image: (384, 384) (h, w) pixels
✅ Generated BLE commands: 19715 bytes
⏳ Trying to auto-discover a printer...
Traceback (most recent call last):
  File "/home/lexpdev/git/catprinter/./print.py", line 83, in <module>
    main()
    ~~~~^^
  File "/home/lexpdev/git/catprinter/./print.py", line 79, in main
    asyncio.run(run_ble(data, device=args.device))
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 720, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/home/lexpdev/git/catprinter/catprinter/ble.py", line 93, in run_ble
    address = await get_device_address(device)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lexpdev/git/catprinter/catprinter/ble.py", line 73, in get_device_address
    return await scan(device, timeout=SCAN_TIMEOUT_S)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lexpdev/git/catprinter/catprinter/ble.py", line 49, in scan
    device = await BleakScanner.find_device_by_filter(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/home/lexpdev/git/catprinter/venv/lib/python3.13/site-packages/bleak/backends/scanner.py", line 249, in find_device_by_filter
    async with cls(detection_callback=apply_filter, **kwargs):
               ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lexpdev/git/catprinter/venv/lib/python3.13/site-packages/bleak/backends/scanner.py", line 95, in __aenter__
    await self.start()
  File "/home/lexpdev/git/catprinter/venv/lib/python3.13/site-packages/bleak/backends/bluezdbus/scanner.py", line 166, in start
    assert_reply(reply)
    ~~~~~~~~~~~~^^^^^^^
  File "/home/lexpdev/git/catprinter/venv/lib/python3.13/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.InProgress] Operation already in progress

How can i fix this error? Is this a bug on the script?

@LuscanoDev
Copy link
Author

tried on a raspberry pi 4, works fine. probably is a problem on the cheap bluetooth receiver on my computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant