This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Python not reading result from bash command


> 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. 		 	   		  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]