w_hoami
w_hoami

Reputation: 101

Why cant I read from stdin after calling python-sane get_devices()

I am trying to create a script which lists locally connected scanners using sane.get_devices(True) and then allow the user to select a device based on the displayed list.

However, after running the sane.get_devices() method, a call to

raw_input("Select device")

just hangs there and no prompt is displayed. Any input from the keyboard ending with an "Enter" has no effect, it just sits there waiting for input.

Digging a bit deeper, I found that

sys.stdin.isatty() returns True 

before the get_devices() call and return False after it. So somehow, I guess, stdin is being redirected to somewhere else.

So bottom line, how can I make raw_input() work after sane.get_devices()?

I am using python 2.7.15 and python-sane 2.8.2

Any help is greatly appreciated.

Upvotes: 0

Views: 59

Answers (0)

Related Questions