Python not reading result from bash command

Aaron Schneider notstop2@users.sourceforge.net
Mon Nov 23 09:02:00 GMT 2015


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: 		 	   		  


More information about the Cygwin-apps mailing list