Skip to content

Commit

Permalink
win32 encoding.
Browse files Browse the repository at this point in the history
jakeichikawasalesforce committed Nov 21, 2024
1 parent cef04d7 commit be38d88
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tabpy/tabpy_tools/custom_query_object.py
Original file line number Diff line number Diff line change
@@ -71,15 +71,12 @@ def query(self, *args, **kwargs):

def get_doc_string(self):
"""Get doc string from customized query"""
try:
if self.custom_query.__doc__ is not None:
return str(
bytes(self.custom_query.__doc__, "utf-8").decode("unicode_escape")
)
else:
return "-- no docstring found in query function --"
except Exception as e:
return "-- no docstring found in query function --"
if self.custom_query.__doc__:
encoding = "utf-8" if sys.platform != "win32" else "cp1252"
return str(
bytes(self.custom_query.__doc__, encoding).decode("unicode_escape")
)
return "-- no docstring found in query function --"

def get_methods(self):
return [self.get_query_method()]

0 comments on commit be38d88

Please sign in to comment.