berniey / html5print

HTML5, CSS, Javascript Pretty Print
Other
30 stars 13 forks source link

JSBeautifier throws TypeError under Python 3.10.4 on Windows 10 #14

Open skanga opened 2 years ago

skanga commented 2 years ago
Addon error: Traceback (most recent call last):
  File "recordTraffic.py", line 134, in response
    outFile.write(JSBeautifier.beautify(flow.response.content.decode(charSet), 2))
  File "C:\bin\Python-3.10.4\lib\site-packages\html5print\jsprint.py", line 93, in beautify
    tree = parser.parse(decodeText(js))
  File "C:\bin\Python-3.10.4\lib\site-packages\slimit\parser.py", line 93, in parse
    return self.parser.parse(text, lexer=self.lexer, debug=debug)
  File "C:\bin\Python-3.10.4\lib\site-packages\ply\yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "C:\bin\Python-3.10.4\lib\site-packages\ply\yacc.py", line 971, in parseopt_notrack
    p.callable(pslice)
  File "C:\bin\Python-3.10.4\lib\site-packages\slimit\parser.py", line 1101, in p_case_block
    p[0] = p[2:-1]
  File "C:\bin\Python-3.10.4\lib\site-packages\ply\yacc.py", line 198, in __getitem__
    if n >= 0: return self.slice[n].value
TypeError: '>=' not supported between instances of 'slice' and 'int'

I am using html5print to pretty print JS code in an MITMproxy addon