1
0
Fork
You've already forked python-barcode
0

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

Open
opened 2021年11月04日 12:09:02 +01:00 by scauchet-google · 3 comments
scauchet-google commented 2021年11月04日 12:09:02 +01:00 (Migrated from github.com)
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'

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 commented 2021年11月15日 21:18:39 +01:00 (Migrated from github.com)
Copy link

Same Issue here

Same Issue here
avmakesh commented 2022年02月02日 12:01:46 +01:00 (Migrated from github.com)
Copy link

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)
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 commented 2022年03月29日 05:50:35 +02:00 (Migrated from github.com)
Copy link

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)

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 in to join this conversation.
No Branch/Tag specified
main
pre-commit-ci-update-config
extensibility
fix_sizes
feature/longer_guard_bar
ean-without-checksum
readme-formatting
cleaning
cleanup
srolin/master
michieldwitte/left-alignment-fix
v0.13.1
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.0
v0.8.3
v0.8.2
v0.8.1
v0.8.0
0.8beta1
0.7
0.7beta4
0.7beta3
0.7beta2
v0.6
v0.6b3
v0.6b2
v0.6b1
v0.5.0
v0.5.0b1
v0.4.3
v0.4.2
v0.4.1
v0.4
v0.4b2
v0.4b1
v0.3
v0.3b1
v0.2.1
v0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
WhyNotHugo/python-barcode#128
Reference in a new issue
WhyNotHugo/python-barcode
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?