Cannot push virtual buttons

Open
#92 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, python
Domain
api

Research direction

Start with the Python binding shown in /usr/lib/python3.10/site-packages/sane.py, especially setattr, and compare its button handling with the C interface's set_option() behavior. Confirm how virtual buttons are represented and make the binding permit the operation; done means the demonstrated scanner.button assignment no longer raises the AttributeError.

Written by the indexing model from the issue text.

Description

Via the C-interface, it is perfectly possible to push virtual buttons, simply by using set_option() with an arbitrary value. The python bindings prevent this, however:

>>> import sane
>>> sane.init()
(16842753, 1, 1, 1)
>>> scanner=sane.open("test")
>>> scanner.enable_test_options = True
>>> scanner.button = True
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/sane.py", line 196, in __setattr__
    raise AttributeError("Buttons don't have values: " + key)
AttributeError: Buttons don't have values: button
Dominant language
C
Stars
61
Forks
22
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-pillow/Sane

All issues in python-pillow/Sane

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.