lib/pycall/import.rb in pycall-0.1.0.alpha.20170224 vs lib/pycall/import.rb in pycall-0.1.0.alpha.20170226
- old
+ new
@@ -20,17 +20,19 @@
end
check_valid_module_variable_name(mod_name, as)
mod = PyCall.import_module(mod_name)
+ raise PyError.fetch unless mod
+
define_singleton_method(as) { mod }
end
def pyfrom(mod_name, import: nil)
raise ArgumentError, "missing identifiers to be imported" unless import
mod = PyCall.import_module(mod_name)
- raise "Unable to import module #{mod_name}" unless mod # TODO: PyError
+ raise PyError.fetch unless mod
case import
when Hash
import.each do |attr, as|
val = PyCall.getattr(mod, attr)