-
Notifications
You must be signed in to change notification settings - Fork 9
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
I have an issue with upcean.fonts #11
Comments
Looks like the font file got corrupted some how. |
Hello,
Thanks for your reply, but I managed to find the problem and it was in my
computer, no worries about this one.
But now, I have an issue with and outoldfile error. Apparently, in the file
getsfname.py, I have an interference with oldoutfile between my code and
the package, I already try to set the oldoutfile = None in my code but it
doesn't work.
Do you have any idea how to solve this problem?
Best regards and thank you very much !!! :)
NB : I send you my code and the error message I get :
error :
Traceback (most recent call last):
File "c:\Users\D001919\Desktop\Repo\ulysse\test.py", line 110, in <module>
result = b.validate_create_barcode(filename=b.filename)
File "c:\Users\D001919\Desktop\Repo\ulysse\test.py", line 99, in
validate_create_barcode
super().validate_create_barcode(filename, size=size)
File
"C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\oopfuncs\oopfuncs.py",
line 113, in validate_create_barcode
return upcean.encode.validate_create_barcode(self.type, self.code,
filename, size, (self.hidesn, self.hidecd, self.hidetext), self.barheight,
self.barwidth, self.textxy,
(self.barcolor, self.textcolor, self.bgcolor), self.imageoutlib);
File
"C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\shortcuts.py",
line 39, in validate_create_barcode
return getattr(upcean.encode.barcode,
"validate_create_"+bctype+"_barcode")(upc,outfile,resize,hideinfo,barheight,barwidth,textxy,barcolor,imageoutlib);
File
"C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\barcode.py",
line 106, in validate_create_ean8_barcode
return
create_upce_barcode(upc,outfile,resize,hideinfo,barheight,barwidth,textxy,barcolor,imageoutlib);
File
"C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\upce.py",
line 68, in create_upce_barcode
oldoutfile = upcean.encode.getsfname.get_save_filename(outfile,
imageoutlib);
File
"C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\getsfname.py",
line 86, in get_save_filename
if(isinstance(oldoutfile, str)):
UnboundLocalError: local variable 'oldoutfile' referenced before assignment
code :
from upcean.oopfuncs import barcode
from upcean.encode import getsfname
class barcode6(barcode):
def __init__(self, code5):
super().__init__('ean8')
self.code5 = code5
self._digits = 8
#self.oldoutfile = None
def validate_create_barcode(self, filename, size=2):
self.code = '{:0>6}1'.format(self.code5)
if len(self.code) < self._digits:
checksum = self.validate_checksum()
if checksum:
self.code += checksum
else:
raise ValueError(f'Invalid upc {self.code}!')
else:
valid = self.validate_checksum()
if not valid:
raise ValueError(
f'Invalid upc {self.code}, validate checksum failed!')
# Assign the returned value to a variable 'image'
# Do further operations with the variable 'image'
# ...
super().validate_create_barcode(filename, size=size)
barcodes_path = str(Path('barcodes/barcodes').absolute())
df = pd.read_excel('df_all.xlsx')
for i, row in df.iterrows():
barcodes_path = Path(barcodes_path + '{}.png'.format(row['IARTCABRG']))
Path(barcodes_path).mkdir(parents=True, exist_ok=True)
for i, row in df.iterrows():
b = barcode6(row['IARTCABRG'])
b.filename = barcodes_path
result = b.validate_create_barcode(filename=b.filename)
…On Sun, 16 Apr 2023 at 21:06, Kazuki Suzuki Przyborowski < ***@***.***> wrote:
Looks like the font file got corrupted some how.
I'll try to see if i can fix it.
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7EY3DD3KSZAJKTAJSSHH53XBQ7LVANCNFSM6AAAAAAW4YRE44>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Made some changes that might fix this. |
Hi Kazuki,
I uninstall and install the package again but it still doesn't work, I even
copy-paste your changes from the Github page, and it doesn't work as well.
Do you have any idea about how I can make this work?
Thanks a lot,
W
(sorry, but i'm in paris so that's why you get my email in the night)
…On Tue, 18 Apr 2023 at 00:57, Kazuki Suzuki Przyborowski < ***@***.***> wrote:
Made some changes that might fix this.
If you can try and tell me if you still get this error.
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7EY3DHOGZXV4F4J6YGHNSTXBXDGNANCNFSM6AAAAAAW4YRE44>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Can you upload the file df_all.xlsx that way I I can test out the code might make it easy to figure out what might be wrong. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I have an issue with upcean.fonts when I try to use validate_create_barcode.
In fact it looks like to don't recognized the fontpathocra in my laptop.
This is my error code :
@KazukiPrzyborowski do you have any idea to fix this problem ? I already install and uninstall the PIL and Pillow packages
The text was updated successfully, but these errors were encountered: