This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Python not reading result from bash command
- From: Aaron Schneider <notstop2 at users dot sourceforge dot net>
- To: "cygwin-apps at cygwin dot com" <cygwin-apps at cygwin dot com>
- Date: Mon, 23 Nov 2015 09:02:11 +0000
- Subject: Python not reading result from bash command
- Authentication-results: sourceware.org; auth=none
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: