I have a script written in python 2.x that checks the data type for a number of different unseen variables. I try to move the code to python 3.x and one of the variables is crushing my program its value is date:2018-04-21 04:00:10. I catch the error with this piece of code:
raise RuntimeError("Value type not handled {}:{}".format(name,value))
Returning this: RuntimeError: Value type not handled date:2018-04-21 04:00:10
The sensitive code can be found below.
Code in python 2.x
if isinstance(value, basestring):
return ("text", "'{}'".format(escape_single_quote(value.encode("utf-8"))))
Code in python 3.x
if isinstance(value, str):
return ("text", "'{}'".format(escape_single_quote(value)))
I have also tried using string_types from six and future library.