gamcil/cblaster

How do I avoid RecursionError?

Opened this issue · 2 comments

Hi! Thank you so much for such a useful tool.
I've got an error for saving cblaterplot HTML after cblaster search.
Error below was reported and the .html file is not created.

[13:52:47] INFO - Parsing results...
[13:52:47] INFO - Found 12528 hits meeting score thresholds for remote search
[13:52:47] INFO - Fetching genomic context of hits
[13:56:55] WARNING - Found no hits for IPG 311873726
[13:56:55] WARNING - Found no hits for IPG 376869762
[13:56:55] WARNING - Found no hits for IPG 143774212
[13:56:55] WARNING - Found no hits for IPG 376867895
[13:56:56] INFO - Searching for clustered hits across 8834 organisms
[13:57:52] INFO - Writing current search session to C:\Users\Xxxxxx\cblaster\cblaster\tests\grd_session15.json
[13:58:01] INFO - Writing summary to C:\Users\Xxxxxx\cblaster\cblaster\tests\grd_summary15.csv
[13:58:06] INFO - Saving cblaster plot HTML to: C:\Users\Xxxxxx\cblaster\cblaster\tests\grdclstr_out15.html
Traceback (most recent call last):
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\Scripts\cblaster.exe_main
.py", line 7, in
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\site-packages\cblaster\main.py", line 469, in main
testing=args.testing,
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\site-packages\cblaster\main.py", line 388, in cblaster
testing=testing,
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\site-packages\cblaster\plot.py", line 300, in plot_session
save_html(data, output)
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\site-packages\cblaster\plot.py", line 270, in save_html
js = f"const data={json.dumps(data)}" + fp.read()
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\json_init
.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\Xxxxxx\anaconda3\envs\cblaster\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
RecursionError: maximum recursion depth exceeded while encoding a JSON object

OS is Windows 10 pro. cblaster is working on Anaconda.
I thought that I should change the recursionlimit by "import sys" "sys.setrecursionlimit(XXXX)"
But, which file should I check and change?

Hi @robin84tk, which version of cblaster are you using?

This is an issue that we had in an earlier version of the program, but I thought we had fixed it (and I haven't run into any issues like this for a long time) - the JSON produced by cblaster shouldn't be deep enough to cause this recursion error. I'm not sure about raising the maximum recursion limit.

In the meantime, this only occurs when building the plot, so you may want to try just using the --binary table option, which will give you essentially the same information.

Thanks your reply. Sorry, my version is 1.3.11. I would update the cblaster. As you wrote above, program other than building the plot did work and I use --binary option if needed.