Python コードを Ruby モジュールに入れて実行したいのですが、Python スタンドアロン スクリプトを Ruby にインポートする方法がわかりません。以下は私のコードです:
Python コード
import ystockquote
import pprint
pprint.pprint(ystockquote.get_all('GOOG'))
ルビー
module PythonInRuby
require "rubypython"
RubyPython.start # start the Python interpreter
cPickle = RubyPython.import("cPickle")
p cPickle.dumps("Testing RubyPython.").rubify
RubyPython.stop # stop the Python interpreter
問題は、 と の間でRubyPython.start
、RubyPython.stop
Python ファイルをインポートする方法がわからないことです。そして、別の問題は、このモジュールで Ruby を実行するためのコードは何ですか?