Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError: maximum recursion depth exceeded while calling a Python object #80

Open
rotcx opened this issue Nov 29, 2023 · 2 comments

Comments

@rotcx
Copy link

rotcx commented Nov 29, 2023

case:https://arxiv.org/abs/1904.09237

image

74%|████████████████████████████▊ | 34/46 [00:00<00:00, 257412.16it/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 256, in translate_full_latex
latex_translated_paragraphs = list(tqdm.auto.tqdm(executor.map(self.worker, latex_original_paragraphs), total=len(latex_original_paragraphs)))
File "/usr/local/lib/python3.7/site-packages/tqdm/std.py", line 1166, in iter
for obj in iterable:
File "/usr/local/Cellar/[email protected]/3.7.12/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 598, in result_iterator
yield fs.pop().result()
File "/usr/local/Cellar/[email protected]/3.7.12/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 428, in result
return self.__get_result()
File "/usr/local/Cellar/[email protected]/3.7.12/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/local/Cellar/[email protected]/3.7.12/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 203, in worker
raise e
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 193, in worker
latex_translated_paragraph = self.translate_paragraph_latex(latex_original_paragraph)
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 172, in translate_paragraph_latex
latex_translated_paragraph = self.translate_text_in_paragraph_latex_and_leading_brace(latex_original_paragraph)
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 167, in translate_text_in_paragraph_latex_and_leading_brace
latex_translated_paragraph = self.translate_text_in_paragraph_latex(latex_original_paragraph)
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 144, in translate_text_in_paragraph_latex
result += self._translate_text_in_paragraph_latex(split) + ' ' + sep + ' '
File "/usr/local/lib/python3.7/site-packages/mathtranslate/translate.py", line 119, in _translate_text_in_paragraph_latex
text_original_paragraph = process_text.split_too_long_paragraphs(text_original_paragraph)
File "/usr/local/lib/python3.7/site-packages/mathtranslate/process_text.py", line 47, in split_too_long_paragraphs
par2 = split_too_long_paragraphs('.'.join(lines[position:]))
File "/usr/local/lib/python3.7/site-packages/mathtranslate/process_text.py", line 47, in split_too_long_paragraphs
par2 = split_too_long_paragraphs('.'.join(lines[position:]))
File "/usr/local/lib/python3.7/site-packages/mathtranslate/process_text.py", line 47, in split_too_long_paragraphs
par2 = split_too_long_paragraphs('.'.join(lines[position:]))
[Previous line repeated 982 more times]
File "/usr/local/lib/python3.7/site-packages/mathtranslate/process_text.py", line 42, in split_too_long_paragraphs
first_words = [get_first_word(line) for line in lines]
File "/usr/local/lib/python3.7/site-packages/mathtranslate/process_text.py", line 42, in
first_words = [get_first_word(line) for line in lines]
File "/usr/local/lib/python3.7/site-packages/mathtranslate/process_text.py", line 26, in get_first_word
words = line.split(' ')
RecursionError: maximum recursion depth exceeded while calling a Python object

@rotcx
Copy link
Author

rotcx commented Dec 3, 2023

@rotcx
Copy link
Author

rotcx commented Dec 3, 2023

case: https://arxiv.org/abs/2302.03169v3

image

caused by unsual tex command: lstlisting
image

temp solution: regexp it and del it

lstlisting_pattern = r"(\\begin\{lstlisting\}.*?\\end\{lstlisting\})"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant