Skip to content

ImageWriter can't be instanciated #138

Description

@arthuRHD

Env:

  • python-barcode v0.13.1
  • python 3.8.10

Whenever I try to store a picture without the default SVG writer, tjis error shows up

>>> iw = ImageWriter(format="PNG")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable

After looking at the code, there is an IF statement that prevent the class declaration in barcode/writer.py at line 330.

if Image is None:
    ImageWriter = None
else:

    class ImageWriter(BaseWriter):  # type: ignore
        format: str
        mode: str
        dpi: int
        ...

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

    documentationthings that need to be documented better

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions