Apparently there are cases where PyPDF3 can generate a warning, but there's no filename to be found, which raises IndexError. In my case, this is happening while running coverage, during the collection phase.
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "/usr/lib/python3.8/warnings.py", line 109, in _showwarnmsg
sw(msg.message, msg.category, msg.filename, msg.lineno,
File "/opt/python/lib/python3.8/site-packages/PyPDF3/pdf.py", line 1186, in _showwarning
file.write(formatWarning(message, category, filename, lineno, line))
File "/opt/python/lib/python3.8/site-packages/PyPDF3/utils.py", line 65, in formatWarning
file = filename.replace("/", "\").rsplit("\", 1)[1] # find the file name
IndexError: list index out of range
Apparently there are cases where PyPDF3 can generate a warning, but there's no filename to be found, which raises IndexError. In my case, this is happening while running coverage, during the collection phase.
Python 3.8.10 (Ubuntu 20.04 LTS)