Improve error handling with python's context manager on open()
Hi,
when encountering an error during vds.open()
in Python's SDK, those two snippets should behave equivalently, but they don't:
vds_source = openvds.open(sd_path, sd_conn_str)
layout = openvds.getLayout(vds_source)
print("ChannelCount: {}".format(layout.getChannelCount()))
openvds.close(vds_source)
this yields RuntimeError: Open error: File::open
with openvds.open(sd_path, sd_conn_str) as vds_source:
layout = openvds.getLayout(vds_source)
print("ChannelCount: {}".format(layout.getChannelCount()))
this causes,
Fatal Python error: Aborted
Thread 0x00007f8d06c8f740 (most recent call first):
...
57032 abort (core dumped)
I suspect it might call openvds.close()
on a failed-opened VDS handle.
slightly off-topic:
As we're trying to debug an issue with connection to seismic ddms, can you provide any tip, on how to improve the verbosity of the open() error?
Thanks, Filip
EDIT: after fixing sd_url to sd_path
, core dumped happens in both cases.