Skip to content

Undefined variable 'utils' in html_decapsulator.py #42

Description

@frantzgd
  File "C:\Users\User\Documents\parser.py", line 14, in <module>
    renderer.render(parsed, f)
  File "C:\Users\User\Documents\venv\Lib\site-packages\rtfparse\renderers\html_decapsulator.py", line 98, in render
    self.render(item, file)
  File "C:\Users\User\Documents\venv\Lib\site-packages\rtfparse\renderers\html_decapsulator.py", line 105, in render
    self.render_symbol(item, file)
  File "C:\Users\User\Documents\venv\Lib\site-packages\rtfparse\renderers\html_decapsulator.py", line 88, in render_symbol
    utils.warn(f"Found an IGNORABLE control symbol which is not a group start!")
    ^^^^^
NameError: name 'utils' is not defined

I'm not sure what "utils" is meant to be, but I resolved this issue by adding the following to html_decapsulator.py:

class utils:
    @staticmethod
    def warn(message: str) -> str:
        return f"WARNING: {message}"
    
    @staticmethod
    def error(message: str) -> str:
        return f"ERROR: {message}"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions