Closed vgdh closed 1 year ago
Hi @vgdh,
A priori, the issue comes from this module. It raises an exception if the text is not a string or the string is a digit. See:
I don't know if it is on purpose or a bug… To fix this specific problem, you could change the condition on line 23 from if not isinstance(text, str) or text.isdigit():
to if not (isinstance(text, str) or text.isdigit()):
or if not isinstance(text, str) or not text.isdigit():
or simply if not isinstance(text, str):
.
Or catch the exception before it occurs and automatically return the digit… well, it is probably not the best solution for languages that do not use Arabic figures.
I think deep-translator
should take digits as inputs. Let have a look at google,
@vgdh And yes, I also encounter the exact exception.
@vgdh I think you have a good point there. When I created the module, I thought that it wouldn't make sense to pass a digit as input, but yes I will update this one. At least for the google translator. Thanks for the input
Description
I pass a string that contain only one number and got this exception.
What I Did