sbmlteam / libCombine

a C++ library for working with the COMBINE Archive format
BSD 2-Clause "Simplified" License
8 stars 5 forks source link

omex.initializeFromArchive(path) aborts python kernel #6

Closed matthiaskoenig closed 7 years ago

matthiaskoenig commented 8 years ago

When calling initFromArchive for files which do not exist or are no zip files the python kernel is aborted. The c++ library should not kill the python kernel, but catch the runtime_error and return None.

import libcombine

def validate_omex(path):
    """ Simple validation by trying to load. """
    omex = libcombine.CombineArchive()
    print("Init archive:")
    if not omex.initializeFromArchive(path):
        print("Invalid Combine Archive")

if __name__ == "__main__":
    path = "BIOMD0000000012.sedx1"
    validate_omex(path)
terminate called after throwing an instance of 'std::runtime_error'
  what():  Error loading zip file!
Aborted (core dumped)
matthiaskoenig commented 8 years ago

BIOMD0000000003.sedx.zip Here an example file.

This makes it impossible to use libcombine because there is no way to check if a file is valid and it will just kill the process which tries to open the archive.

fbergmann commented 7 years ago

This should now be resolved with commit 7e2fe08d478eba7c87fb01655c8b2fd0f9d0f8a6, now all occuring c++ exceptions are caught in wrapped languages ... additionally initializeFromArchive now returns False on non-existing files as well.

matthiaskoenig commented 7 years ago

Is working. Thanks.