Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError occurred while using ikos-view #303

Open
ChAoSUnItY opened this issue Nov 23, 2024 · 4 comments
Open

TypeError occurred while using ikos-view #303

ChAoSUnItY opened this issue Nov 23, 2024 · 4 comments

Comments

@ChAoSUnItY
Copy link

While I am trying to view the output of a analyzing, I found when I click on the file to view source code and the analyzing result, the page failed to load and the following error message appears on console session:

----------------------------------------
Exception occurred during processing of request from ('::1', 47106, 0, 0)
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.13/socketserver.py", line 318, in _handle_request_noblock
    self.process_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.13/socketserver.py", line 349, in process_request
    self.finish_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.13/socketserver.py", line 362, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.13/socketserver.py", line 761, in __init__
    self.handle()
    ~~~~~~~~~~~^^
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.13/http/server.py", line 436, in handle
    self.handle_one_request()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.13/http/server.py", line 424, in handle_one_request
    method()
    ~~~~~~^^
  File "/home/linuxbrew/.linuxbrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/ikos/view.py", line 146, in do_GET
    f(**m.groupdict())
    ~^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/ikos/view.py", line 259, in _serve_report
    code = highlight(code, lexer, fmt)
  File "/home/linuxbrew/.linuxbrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/pygments/__init__.py", line 85, in highlight
    return format(lex(code, lexer), formatter, outfile)
  File "/home/linuxbrew/.linuxbrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/pygments/__init__.py", line 64, in format
    formatter.format(tokens, realoutfile)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/pygments/formatter.py", line 95, in format
    return self.format_unencoded(tokensource, outfile)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/Cellar/ikos/3.4_1/libexec/lib/python3.13/site-packages/pygments/formatters/html.py", line 873, in format_unencoded
    source = self.wrap(source, outfile)
TypeError: Formatter.wrap() takes 2 positional arguments but 3 were given
----------------------------------------

I'm currently using Python 3.13.0 on WSL 2.

@ivanperez-keera
Copy link
Collaborator

I think this could be a problem with APIs used by pygments having changed. I think the line in question (in the current version) is: https://github.com/pygments/pygments/blob/27649ebbf5a2519725036b48ec99ef7745f100af/pygments/formatters/html.py#L979C27-L979C31

Can you try a more modern version of pygments?

@ivanperez-keera
Copy link
Collaborator

The signature of wrap in the view's Formatter (which inherits from HtmlFormatter) is compatible with pygments':

IKOS:

class Formatter(HtmlFormatter):                                                  
    def wrap(self, source):

Pygments:

class HtmlFormatter(Formatter):
    def wrap(self, source):

@ChAoSUnItY
Copy link
Author

Yes, I tried the latest pygments and it's fine. I was installing IKOS from homebrew just today, is it caused by improper version locking?

@ivanperez-keera
Copy link
Collaborator

Sounds like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants