From: Norjee Date: 2005-07-30T23:01:02+09:00 Subject: Ruby-Python; using python from within ruby At the moment I'm looking at rails, it seems like a great framework. The only downside it has is its rather limited availability of 3rd party libraries. At the moment there are at least two libraries I need that are available to python but not to ruby (search engine, either xapian or lucene( python has bindings to both, ruby has neither), pydns and another custom python script) After looking for a solution I came across ruby-python (http://raa.ruby-lang.org/project/ruby-python/). Sadly enough it is a little bit outdated. It seems to need ruby 2.6 and python 1.5 while I'm using ruby 1.82 and python 2.4. I tried looking into the source code, changing reference to python 1.5 to python 2.4, changed PyObject_HEAD_INIT(&PyType_Type) to PyObject_HEAD_INIT(NULL) and set ob_type to &PyType_Type in the init method (the new gcc compiler doesn't like non constant elements outside function calls) and even got it to compile. However, this is about as far as my knowledge of C goes, and i end up with a segmentation fault. Thus somewhere there's a pointer or reference not pointing to the right spot. I have absolutely no clue how to solve this. Are there any other libraries which allow ruby to execute python code, or has anybody got ruby-python to work with recent versions of both ruby and python? If there is no solution i could of course shell execution to run some python scripts, using that output, but I'd rather not do this as it'll create quite some messy interaction. Moreover, I think having ruby able to run use python libraries would definitely help others to adapt to using ruby, as I'm sure that the lack of libraries is holding them back to use ruby, just as it does for me. Being able to use at least a part of the libraries available to python gives ruby a lot more libraries, with just having one wrapper library.