do {
let model = try Python.attemptImport("FinalTest")
let value = try? model.get(true)
} catch {
print("==> error: \(error)")
def swift_call_target():
raise Exception("This is an example exception for GET")
Is there any way to call throw function?
Please advice
Thanks
--
To unsubscribe from this group and stop receiving emails from it, send an email to swift+un...@tensorflow.org.
This e-mail and any files transmitted with it may contain confidential and privileged information are for the sole use of the intended recipient(s). If you are not the intended recipient, please apprise the sender by reply e-mail and destroy all copies and the original message. Any unauthorised disclosure, dissemination, forwarding, printing or copying of this email or any action taken on this e-mail is strictly prohibited and may be unlawful. The recipient acknowledges that Jellyfish Technologies or its subsidiaries and associated companies, are unable to exercise control or ensure or guarantee the integrity of the contents of the information contained in e-mail transmissions and further acknowledges that any views expressed in this message are those of the individual senders and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of Jellyfish Technologies. Since Jellyfish Technologies cannot make a warranty that this email is free of virus/errors, kindly scan the email with antivirus software before opening the attachments/links.
func callFunction(name: String, withArguments args: [PythonConvertible]) -> Result<PythonObject, Error> {
guard let functionObject = self.checking[dynamicMember: name] else {
return .failure(CustomError.with(localizedDescription: "Could not access PythonObject member \(name)"))
}
do {
let data = try functionObject.throwing.dynamicallyCall(withArguments: args)
return .success(data)
} catch {
let pythonError = error as? PythonError
let localizedDescription = pythonError?.description ?? error.localizedDescription
return .failure(CustomError.with(localizedDescription: localizedDescription))
}
}
private let gp = Python.import("gphoto2")
private lazy var context = gp.Context()
private lazy var camera_config = camera.get_config(context)
let result = callFunction(name: "capture", withArguments: [gp.GP_CAPTURE_IMAGE])
switch result {
case .success(let py):
print(py)
case .failure(let err) :
print(err.localizedDescription)
break
}
Checcking[dynamicMember : name ] is getting nillet file_path = camera.capture(gp.GP_CAPTURE_IMAGE)
Please can you look it I did what you have guided.