From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailsrv.cs.umass.edu (mailsrv.cs.umass.edu [128.119.240.136]) by sourceware.org (Postfix) with ESMTPS id 57BA23858011 for ; Wed, 31 Aug 2022 20:43:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 57BA23858011 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.umass.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.umass.edu Received: from [192.168.50.148] (c-24-62-201-179.hsd1.ma.comcast.net [24.62.201.179]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id 097534023BB2; Wed, 31 Aug 2022 16:43:51 -0400 (EDT) Message-ID: Date: Wed, 31 Aug 2022 16:43:48 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Reply-To: moss@cs.umass.edu Subject: Re: Running cygwin from python Content-Language: en-US To: =?UTF-8?Q?Ren=c3=a9_Berber?= , "cygwin@cygwin.com" References: <251df5f2-56b8-0812-c990-a517bd686ec5@cs.umass.edu> <7bf1b8fe-a43c-0747-0c18-2ac968f8245a@gmail.com> From: Eliot Moss In-Reply-To: <7bf1b8fe-a43c-0747-0c18-2ac968f8245a@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 8/31/2022 4:40 PM, René Berber wrote: > On 8/31/2022 1:39 PM, Eliot Moss wrote: > >> On 8/31/2022 1:41 PM, Toyoshima Denis wrote: >>> Hi there, how are you? >>> >>> I’d like to know if there’s any possibility of running simple commands inside Cygwin through >>> Python code. > -----------------^^^^^^^^^^^^^^^^^^^^ > >>> If yes, could you provide some examples? >> >> This will happen automatically if you use Cygwin's python. >> If you don't, then you have to run a program (for example, ls) >> by giving the path to the executable - on my system that is: >> >> C:\cygwin64\bin\ls.exe > [snip] > > I think he meant something like this: > > $ python > Python 3.9.10 (main, Jan 20 2022, 21:37:52) > [GCC 11.2.0] on cygwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import os > >>> os.system("ls") > ... output is a list of strings with the contents of current directory > ^D > > Which is not a question for the Cygwin list, its elementary python. ... except if the OP is talking ab *Windows* python, in which case the os package will run Windows things, not cygwin ones ... Best - Eliot