# TypeError: slice indices must be integers or None or have an \_\_index\_\_ method

**URL:** <https://forum.biobakery.org/t/typeerror-slice-indices-must-be-integers-or-none-or-have-an-index-method/6891>\
**Category:** LEfSe\
**Created:** [April 3, 2024, 6:46pm UTC](https://forum.biobakery.org/t/typeerror-slice-indices-must-be-integers-or-none-or-have-an-index-method/6891 "2024-04-03T18:46:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![toba1](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@toba1](https://forum.biobakery.org/u/toba1)\
**Post date:** [April 3, 2024, 6:46pm UTC](https://forum.biobakery.org/t/typeerror-slice-indices-must-be-integers-or-none-or-have-an-index-method/6891/1 "2024-04-03T18:46:30Z")

</div>

Hi everyone!  
I would like to lefse figure, but I got that error.  
(lefse) eb-pth-j4yxwm37:exported-featureca-table toba1$ lefse\_plot\_res.py biome.res biome.png  
Traceback (most recent call last):  
File “/Users/miniconda3/envs/lefse/bin/lefse\_plot\_res.py”, line 10, in   
sys.exit(plot\_res())  
^^^^^^^^^^  
File “/Users/miniconda3/envs/lefse/lib/python3.12/site-packages/lefse/lefse\_plot\_res.py”, line 177, in plot\_res  
else: plot\_histo\_hor(params[‘output\_file’],params,data,len(data[‘cls’]) == 2,params[‘report\_features’])  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/miniconda3/envs/lefse/lib/python3.12/site-packages/lefse/lefse\_plot\_res.py”, line 104, in plot\_histo\_hor  
if len(rr) \> params[‘max\_feature\_len’]: rr = rr[:params[‘max\_feature\_len’]/2-2]+" […]"+rr[-params[‘max\_feature\_len’]/2+2:]  
~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
TypeError: slice indices must be integers or None or have an **index** method

Could you help me?

---

<div class="post-metadata">

**Author:** ![deppworld](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/deppworld/32/2843_2.png) [@deppworld](https://forum.biobakery.org/u/deppworld)\
**Post date:** [May 30, 2024, 1:02pm UTC](https://forum.biobakery.org/t/typeerror-slice-indices-must-be-integers-or-none-or-have-an-index-method/6891/2 "2024-05-30T13:02:55Z")

</div>

I am also getting the same error. While plotting the graph.

dverma2@EB-ONC-J8Q3FF3:/mnt/f/coin/LEfSe/pathway$ lefse\_plot\_res.py res\_pathway.res Pathway\_small.png  
Traceback (most recent call last):  
File “/home/dverma2/miniforge3/bin/lefse\_plot\_res.py”, line 10, in   
sys.exit(plot\_res())  
File “/home/dverma2/miniforge3/lib/python3.10/site-packages/lefse/lefse\_plot\_res.py”, line 177, in plot\_res  
else: plot\_histo\_hor(params[‘output\_file’],params,data,len(data[‘cls’]) == 2,params[‘report\_features’])  
File “/home/dverma2/miniforge3/lib/python3.10/site-packages/lefse/lefse\_plot\_res.py”, line 104, in plot\_histo\_hor  
if len(rr) \> params[‘max\_feature\_len’]: rr = rr[:params[‘max\_feature\_len’]/2-2]+" […]"+rr[-params[‘max\_feature\_len’]/2+2:]  
TypeError: slice indices must be integers or None or have an **index** method

Please help.
