I am trying to measure the output of a pulse generator using a Keysight DSOX3024A oscilloscope (using some programs from LabVIEW that I've rewritten in python) and I have run into a curious timeout problem thats got me stumped for awhile now. I can query the data just fine when I run through it step by step in a jupyter notebook, but it times out when I copy and past the same code in a script -> even if I had sufficiently long time.sleep() in between each line of code. My guess from scouring the internet is that it may be a problem with the instrument sending back the correct read character. I have already tried manually setting the timeout to 5 seconds to no avail. Anyways the code flow is as follows:
scope.write(":DIG")
scope.write(":*CLS")
wavegen.enable_output()
wavegen.send_trigger()
scope.query(":WAVeform:PREamble?")
where I use the last line to setup the data I later get with query_binary_values(). Regardless I've tested that any query or read operation after those two commands in my script causes a timeout (even stuff like scope.query("*OPC?") which is used to reply when the scope has completed its tasks. So I'm quite confused why it works in a jupyter notebook but not in a script if there is anything different in how the code is handled where some execution is complete flag is sent when a python cell completes or whatnot.
Any help is greatly appreciated (by the way other ways of reading the data works in a script just not after sending the :DIGitize command)
Thanks!