lib/rbbt/util/python.rb in rbbt-util-5.34.3 vs lib/rbbt/util/python.rb in rbbt-util-5.34.4
- old
+ new
@@ -2,10 +2,15 @@
require 'pycall/import'
module RbbtPython
extend PyCall::Import
+ def self.script(text, options = {})
+ Log.debug "Running python script:\n#{text.dup}"
+ text = StringIO.new text unless IO === text
+ CMD.cmd_log(:python, options.merge(:in => text))
+ end
def self.add_path(path)
self.run 'sys' do
sys.path.append path
end
@@ -85,10 +90,12 @@
module_eval(&block)
end
def self.run_log(mod = nil, imports = nil, severity = 0, severity_err = nil, &block)
if mod
- if Array === imports
+ if imports == "*" || imports == ["*"]
+ pyfrom mod
+ elsif Array === imports
pyfrom mod, :import => imports
elsif Hash === imports
pyimport mod, imports
else
pyimport mod