This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
RE: 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:04:51 +0000
- Subject: RE: Python not reading result from bash command
- Authentication-results: sourceware.org; auth=none
- References: <DUB126-W46B458D42BA7E8C49355ECCE070 at phx dot gbl>
> 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.