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

close() hanging if a Ctrl+C presseed ie. KeyboardInterrupt was raised #32

Open
raczben opened this issue Sep 5, 2018 · 1 comment
Open

Comments

@raczben
Copy link

raczben commented Sep 5, 2018

The Instrument.close() method hanging (or throws a timeout exception) if ctrl+c was pressed during a read operation.
Some instrument commands consume time (eg.: saving/fetching screenshot of the oscilloscope). If I press Ctrl+C during an ask() or read(), the close()method cannot finish properly: it throws timeout error after the timeout time has been elapsed, which timeout must be big in some cases (because of the time consuming commands.)

@raczben raczben changed the title close() hanging if a KeyboardInterrupt was raised close() hanging if a Ctrl+C presseed ie. KeyboardInterrupt was raised Sep 5, 2018
@mileslucas
Copy link

I was thinking about making a pull request that incorporates a context manager for the Device class such that I could use

with Instrument(myip) as inst:
    inst.ask(‘*IDN?’)l

The implementation wouldn’t be hard but I’m not sure if that would actually fix this problem.

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

2 participants