Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8474085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:31:49+00:00 2026-06-10T17:31:49+00:00

How can I call python running in shell from ruby. Actually I need ruby

  • 0

How can I call python running in shell from ruby. Actually I need ruby to communicate with some app running under the python in shell. So I need ruby to call python (command ‘python’) in cmd and then import libraries (command ‘import xyz’) under the python environment, and thne run functions of this imported libraries (for example ‘xyz.showdate()’), and get result of course.

I tryed to use IO.popen and Open3.popen3 functions to achieve this, but I do something wrong.

Actually I use jruby on rails, but it should be same with ruby, I guess.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:31:51+00:00Added an answer on June 10, 2026 at 5:31 pm

    You probably don’t really want to be doing this, this is going to make your ruby script excessively convoluted when you could probably get the result directly in ruby.

    If you however decide to go that way, you could create a python script that does what you need and run it from the ruby script:

    # python-script.py 
    import xyz
    if __name__ == '__main__':
        xyz.showdate()
    

    You would then arrange so that your ruby script calls the following command:

    python path/to/python-script.py
    

    Provided your xyz.showdate prints the date, you can collect standard output to get the result.

    But again, that’s probably not a great idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I need to use Python and C++. I can call Python function
In Python, how can I print the current call stack from within a method
I've got a Python program that reads from sys.stdin , so I can call
I have a Webserver running in Python. He is getting some Data from some
Update: this error can be reproduced simply by running this from the command line:
In python, If I have a class foo , I can call foo.__module__ to
In Ruby I can call methods with array elements used as positional parameters like
From this code I can call bmwCars.CopyToDataTable() as I expected. var bmwCars = from
Using a delegate I can call any function asynchronously. From the documentation I understand
I've been running Python scripts that make several calls to some functions, say F1(x)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.