You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def timestamp_tz_parse(s):
# if timezome is simply UTC...
if s.endswith('+00'):
# remove time zone
ts = timestamp_parse(s[:-3])
ts = ts.replace(tzinfo=pytz.UTC)
return ts
# other wise do a real parse (slower)
return parser.parse(s)
raises TypeError: endswith first arg must be bytes or a tuple of bytes, not str at this line.
It appears that s is a bytes object, not str. Changing if s.endswith('+00'): to if s.endswith(b'+00'): resolves the issue for me.
I'm using:
Python 3.4.4
vertica-python==0.6.2
The text was updated successfully, but these errors were encountered:
trianta2
changed the title
Python 3 fetch issue
Python 3 timestamp_tz_parse TypeError
May 11, 2016
A Vertica TimestampTz column gets parsed by timestamp_tz_parse while a Timestamp column gets parsed by timestamp_parse. The timestamp_parse method ends up calling datetime.strptime which does require a string. In this case it might be better to just coerce to strings in these functions.
/usr/local/lib/python3.5/dist-packages/vertica_python-0.6.2-py3.5.egg/vertica_python/vertica/column.py in timestamp_tz_parse(s)
64 def timestamp_tz_parse(s):
65 # if timezome is simply UTC...
---> 66 if s.endswith('+00'):
67 # remove time zone
68 ts = timestamp_parse(s[:-3])
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
The following function:
raises
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
at this line.It appears that
s
is a bytes object, not str. Changingif s.endswith('+00'):
toif s.endswith(b'+00'):
resolves the issue for me.I'm using:
The text was updated successfully, but these errors were encountered: