www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/08/31/16:41:37

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E12A53850431
Authentication-Results: sourceware.org;
dmarc=fail (p=none dis=none) header.from=gmail.com
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org
X-Injected-Via-Gmane: http://gmane.org/
To: cygwin AT cygwin DOT com
From: =?UTF-8?Q?Ren=c3=a9_Berber?= <rene DOT berber AT gmail DOT com>
Subject: Re: Running cygwin from python
Date: Wed, 31 Aug 2022 15:40:02 -0500
Message-ID: <7bf1b8fe-a43c-0747-0c18-2ac968f8245a@gmail.com>
References: <DB7PR05MB4252EB21D222A73D2AC7B6E9F1789 AT DB7PR05MB4252 DOT eurprd05 DOT prod DOT outlook DOT com>
<251df5f2-56b8-0812-c990-a517bd686ec5 AT cs DOT umass DOT edu>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19)
Gecko/20081209 Lightning/0.9 Thunderbird/2.0.0.19 Mnenhy/0.7.6.0
In-Reply-To: <251df5f2-56b8-0812-c990-a517bd686ec5@cs.umass.edu>
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,
FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,
HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A,
NML_ADSP_CUSTOM_MED, 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
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 27VKfMW5011841

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.
-- 



-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019