js-beautify icon indicating copy to clipboard operation
js-beautify copied to clipboard

python IndexError: list index out of range

Open simonfire007 opened this issue 5 years ago • 2 comments

when i use js-beautify chapter.min.js,i get IndexError: list index out of range. this is js file: https://simonfire007.github.io/vip/chapter.min.js

simonfire007 avatar Mar 29 '19 10:03 simonfire007

@simonfire007 Do you get any more information? Stack trace?

bitwiseman avatar Apr 22 '19 19:04 bitwiseman

@simonfire007 Do you get any more information? Stack trace?

this is error type in python:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/simon/.local/lib/python3.6/site-packages/jsbeautifier/__init__.py", line 76, in beautify
    return b.beautify(string, opts)
  File "/home/simon/.local/lib/python3.6/site-packages/jsbeautifier/javascript/beautifier.py", line 175, in beautify
    source_text = self.unpack(source_text, self._options.eval_code)
  File "/home/simon/.local/lib/python3.6/site-packages/jsbeautifier/javascript/beautifier.py", line 257, in unpack
    return unpackers.run(source, evalcode)
  File "/home/simon/.local/lib/python3.6/site-packages/jsbeautifier/unpackers/__init__.py", line 49, in run
    source = unpacker.unpack(source)
  File "/home/simon/.local/lib/python3.6/site-packages/jsbeautifier/unpackers/packer.py", line 64, in unpack
    source = re.sub(r'\b\w+\b', lookup, payload)
  File "/usr/lib/python3.6/re.py", line 191, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/home/simon/.local/lib/python3.6/site-packages/jsbeautifier/unpackers/packer.py", line 62, in lookup
    return symtab[unbase(word)] or word
IndexError: list index out of range

i think this error maybe related to the split("|"),if i edit the js file and change split("|") to split(" "),it works.

simonfire007 avatar Apr 23 '19 09:04 simonfire007