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

Getting set_options() missing 1 required positional argument: 'options' Error when trying to generate an Image #128

Open
scauchet-google opened this issue Nov 4, 2021 · 3 comments

Comments

@scauchet-google
Copy link

I'm getting the following error as soon as Pillow is addedin my env.
I've tried with both Pillow 8.0.0 and 8.4.0.

This comes after either write or a save, i.e
ean = EAN13(query,writer=ImageWriter) buff = io.BytesIO() ean.write(buff)

or
ean = EAN13(query,writer=ImageWriter) filename = ean.save('ean13')

When uninstalling Pillow, the error disappears

File "/Devs/trixintegration/trix/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/Devs/trixintegration/trix/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Devs/trixintegration/trix/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/Devs/trixintegration/trix/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/Devs/trixintegration/barcodeapp.py", line 20, in gen_barcode
ean.save(query)
File "/Devs/trixintegration/trix/lib/python3.8/site-packages/barcode/base.py", line 65, in save
output = self.render(options)
File "/Devs/trixintegration/trix/lib/python3.8/site-packages/barcode/ean.py", line 121, in render
return Barcode.render(self, options, text)
File "/Devs/trixintegration/trix/lib/python3.8/site-packages/barcode/base.py", line 103, in render
self.writer.set_options(options)
TypeError: set_options() missing 1 required positional argument: 'options'

@msayed-net
Copy link

Same Issue here

@ghost
Copy link

ghost commented Feb 2, 2022

See the set option here : https://python-barcode.readthedocs.io/en/stable/writers/index.html?highlight=number_of_lines
use this way :

           from io import BytesIO
           from barcode import EAN13

           options = {
                            "module_width": 0.1,
                            "module_height": 7,
                            "quiet_zone": 0.1,
                           "write_text": False,
                           "text_distance": 2,
                           }
          buff= BytesIO()
          ean = EAN13(query,writer=ImageWriter()).write(buff,options)

@tjzo
Copy link

tjzo commented Mar 29, 2022

same issue
just replace
ean = EAN13(query,writer=ImageWriter) buff = io.BytesIO() ean.write(buff)
with
ean = EAN13(query,writer=ImageWriter()) buff = io.BytesIO() ean.write(buff)

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

3 participants