2

I'm using watson caption converter and I'm getting an indexError list out of range while using jupyter notebook. Any way to fix this error?

Here is the error:

IndexError                                Traceback (most recent call last)
<ipython-input-2-c505fadd11ee> in <module>
131 
132             # formats time for SRT format
--> 133             st_time = format_time(x[2], "srt")
134             en_time = format_time(x[3], "srt")
135 

<ipython-input-2-c505fadd11ee> in format_time(time, format)
 15 # function to format time for SRT file
 16 def format_time(time, format):
---> 17     ms = (str(time).split("."))[1]
 18     sec = time
 19     min = sec / 60

IndexError: list index out of range
Kevin
  • 21
  • 1
  • probably see https://stackoverflow.com/questions/1098643/indexerror-list-index-out-of-range-and-python?rq=1 – Tejas Shetty Nov 10 '21 at 16:51
  • Welcome @Kevin . Please do see https://stackoverflow.com/tour – Tejas Shetty Nov 10 '21 at 16:53
  • Does this answer your question? [Why does this iterative list-growing code give IndexError: list assignment index out of range?](https://stackoverflow.com/questions/5653533/why-does-this-iterative-list-growing-code-give-indexerror-list-assignment-index) – Tejas Shetty Nov 10 '21 at 16:53
  • @TejasShetty i know what an indexerror is, just don't know how to fix this one. It only occurred with a large audio file so I'm wondering if it's due to that somehow – Kevin Nov 12 '21 at 15:35
  • ok Great. Can you let us know @Kevin the whole code that you actually ran ? It is hard to know with what you have presented here. for example I have no idea what `x` is. Include as much detail as you can. – Tejas Shetty Nov 16 '21 at 07:07

0 Answers0