Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.05; 'output': 0.05; 'modify': 0.07; 'executable': 0.09; 'run,': 0.09; 'subject:script': 0.09; 'python': 0.11; 'gui': 0.12; 'fine.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'interpreter,': 0.16; 'invoking': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'ruby;': 0.16; 'runs,': 0.16; 'simpson': 0.16; 'subject:run': 0.16; 'subject:python': 0.16; 'do,': 0.16; 'wrote:': 0.18; 'command': 0.22; 'machine': 0.22; 'code,': 0.22; 'header:User-Agent:1': 0.23; 'script.': 0.24; 'versions': 0.24; 'cheers,': 0.24; 'environment': 0.24; 'script': 0.25; 'this:': 0.26; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'external': 0.29; 'program,': 0.31; '(usually': 0.31; 'os,': 0.31; 'shoot': 0.31; 'run': 0.32; 'another': 0.32; 'linux': 0.33; 'says': 0.33; 'guess': 0.33; 'subject:from': 0.34; 'but': 0.35; 'there': 0.35; 'c++': 0.36; 'received:com.au': 0.36; 'skip:> 10': 0.36; 'charset:us-ascii': 0.36; 'being': 0.38; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; 'does': 0.39; 'bad': 0.39; 'to:addr:python.org': 0.39; 'easy': 0.60; 'full': 0.61; 'content-disposition:inline': 0.62; 'note:': 0.66; 'prompt': 0.68; 'further,': 0.74; 'yourself': 0.78; 'fails,': 0.84; 'messed': 0.84; 'shawn': 0.84 Date: Thu, 25 Sep 2014 10:44:28 +1000 From: Cameron Simpson To: python-list@python.org Subject: Re: cannot run a ruby script from a python script. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <8c24ba60-9f0c-4b29-8c3e-64139af3a676@googlegroups.com> User-Agent: Mutt/1.5.21 (2010-09-15) References: <8c24ba60-9f0c-4b29-8c3e-64139af3a676@googlegroups.com> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=JeL9mMyyVd4A:10 a=TuChCMWFACkA:10 a=r5UFkecV8NkA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=VBKQ84WMAAAA:8 a=2g8U3tQkMi_Vz7La_2oA:9 a=CjuIK1q_8ugA:10 a=h0-Cxfrown8A:10 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411605884 news.xs4all.nl 2938 [2001:888:2000:d::a6]:58452 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78319 On 24Sep2014 16:57, Shawn Bright wrote: >i have a linux computer that i use to run a GUI (wxGTK) program. In this program, there is a call to run an external ruby script. > >command = "ruby run_my_command.rb &" >os.system(command) > >however, when it runs, i get this in the terminal >sh: 1: ruby: not found > >i had considered that the path to the executable was messed up or somesuch, but when i just run python in the interpreter, it works fine. > >also, i have another computer with identical hardware, same OS, same package versions that it does work on also. This machine is to be a backup. > >Another note: When i run which ruby i get the path to the ruby executable. If i use that in my code, it will run, however, it will not be able to find any of the modules that i need for the ruby script to import. For your edification: modify your command to be this: command = "which ruby; echo $PATH; ruby run_my_command.rb &" and see if the output says what you expect. From the behaviour you describe I would expect that the GUI program, when it fails, is not being invoked from your command line but from some menu or suchlike. Further, I would guess that the invoking program (window manager, whatever) does not have ruby in its $PATH. This same effect obtains when you use the full path to ruby (usually a bad idea because your script may not work on another system where ruby is somewhere different) because like $PATH, the ruby search path also lacks the directories where the modules reside. When you run it from your command prompt or from the python interpreter your environment is already set up with this extra information. Cheers, Cameron Simpson C makes it easy for you to shoot yourself in the foot. C++ makes that harder, but when you do, it blows away your whole leg. - Bjarne Stroustrup