Python not reading result from bash command

Marco Atzeri marco.atzeri@gmail.com
Mon Nov 23 09:13:00 GMT 2015



On 23/11/2015 10:04, Aaron Schneider wrote:
>> 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 = str(sys.argv[1])
>> temp_date = 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 <module>
>> temp_date = 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 for windows. 		 	   		
>

what is adb ?

I suspect it is mainly pty communication (or lack of) between
cygwin and not cygwin programs.
See
   https://github.com/mintty/mintty/issues/56



More information about the Cygwin-apps mailing list