tensorflow/swift

Throwing and Import

jhawgs opened this issue · 0 comments

I have a block of code that is reliant upon receiving import errors. Specifically, when attempting to import a non-existent module, I want to be able to catch the import error instead of having the application crash. I tried to use throwing consistently with the Python Interoperability doc, like so:

do { let nonExistentModule: PythonObject = try Python.import.throwing("non_existent_module") } catch { // handle error }

It returns:

Value of type '(String) -> PythonObject' has no member 'throwing'

Is this implemented differently for import, or is this capability not supported?