Skip to content

Commit be38d88

Browse files
win32 encoding.
1 parent cef04d7 commit be38d88

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tabpy/tabpy_tools/custom_query_object.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,12 @@ def query(self, *args, **kwargs):
7171

7272
def get_doc_string(self):
7373
"""Get doc string from customized query"""
74-
try:
75-
if self.custom_query.__doc__ is not None:
76-
return str(
77-
bytes(self.custom_query.__doc__, "utf-8").decode("unicode_escape")
78-
)
79-
else:
80-
return "-- no docstring found in query function --"
81-
except Exception as e:
82-
return "-- no docstring found in query function --"
74+
if self.custom_query.__doc__:
75+
encoding = "utf-8" if sys.platform != "win32" else "cp1252"
76+
return str(
77+
bytes(self.custom_query.__doc__, encoding).decode("unicode_escape")
78+
)
79+
return "-- no docstring found in query function --"
8380

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

0 commit comments

Comments
 (0)