From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49339 invoked by alias); 23 Nov 2015 09:04:57 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 49326 invoked by uid 89); 23 Nov 2015 09:04:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: DUB004-OMC4S2.hotmail.com Received: from dub004-omc4s2.hotmail.com (HELO DUB004-OMC4S2.hotmail.com) (157.55.2.77) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Mon, 23 Nov 2015 09:04:54 +0000 Received: from DUB126-W53 ([157.55.2.71]) by DUB004-OMC4S2.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Mon, 23 Nov 2015 01:04:51 -0800 X-TMN: [EIstK7+6j0Mqn1jXDmFXkCmxaA88Riz9] Message-ID: From: Aaron Schneider To: "cygwin-apps@cygwin.com" Subject: RE: Python not reading result from bash command Date: Mon, 23 Nov 2015 09:04:00 -0000 In-Reply-To: References: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00056.txt.bz2 > Subject: Python not reading result from bash command > > Trying to read an argument as string, however doesn't work on python for = cygwin. Tested on Python 3.5.0 (32-bit) from Python Software Foundation and= works perfectly. > > test.py: > import datetime > import sys > my_date =3D str(sys.argv[1]) > temp_date =3D datetime.datetime.strptime(some_date, "%Y%m%d%H%M%S") > > $ python test.py $(adb shell 'su 0 date +"%Y%m%d%H%M%S"') > Traceback (most recent call last): > File "test.py", line 32, in > temp_date =3D datetime.datetime.strptime(some_date, "%Y%m%d%H%M%S") > File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime > data_string[found.end():]) > ValueError: unconverted data remains: I mean that works perfectly from Windows Powershell with official Python fo= r windows.=20=09=09=20=09=20=20=20=09=09=20=20