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

I got this error, can anyone help me, please? #44

Closed
direselign opened this issue Mar 5, 2019 · 7 comments
Closed

I got this error, can anyone help me, please? #44

direselign opened this issue Mar 5, 2019 · 7 comments

Comments

@direselign
Copy link

here is the error
python run.py -w 5 -f 64 -l am
0%| | 0/1000 [00:00<?, ?it/s]multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/test/Anaconda3/envs/py35/lib/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/test/Documents/direse/scene/TextRecognitionDataGenerator/TextRecognitionDataGenerator/data_generator.py", line 22, in generate_from_tuple
cls.generate(*t)
File "/home/test/Documents/direse/scene/TextRecognitionDataGenerator/TextRecognitionDataGenerator/data_generator.py", line 36, in generate
image = ComputerTextGenerator.generate(text, font, text_color, size, orientation, space_width)
File "/home/test/Documents/direse/scene/TextRecognitionDataGenerator/TextRecognitionDataGenerator/computer_text_generator.py", line 9, in generate
return cls.__generate_horizontal_text(text, font, text_color, font_size, space_width)
File "/home/test/Documents/direse/scene/TextRecognitionDataGenerator/TextRecognitionDataGenerator/computer_text_generator.py", line 17, in __generate_horizontal_text
image_font = ImageFont.truetype(font=font, size=font_size)
File "/home/test/Anaconda3/envs/py35/lib/python3.5/site-packages/PIL/ImageFont.py", line 261, in truetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/home/test/Anaconda3/envs/py35/lib/python3.5/site-packages/PIL/ImageFont.py", line 144, in init
self.font = core.getfont(font, size, index, encoding, layout_engine=layout_engine)
OSError: unknown file format
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "run.py", line 342, in
main()
File "run.py", line 330, in main
), total=args.count):
File "/home/test/Anaconda3/envs/py35/lib/python3.5/site-packages/tqdm/_tqdm.py", line 930, in iter
for obj in iterable:
File "/home/test/Anaconda3/envs/py35/lib/python3.5/multiprocessing/pool.py", line 731, in next
raise value
OSError: unknown file format
Exception ignored in: <bound method tqdm.del of 0%| | 0/1000 [00:00<?, ?it/s]>
Traceback (most recent call last):
File "/home/test/Anaconda3/envs/py35/lib/python3.5/site-packages/tqdm/_tqdm.py", line 882, in del
File "/home/test/Anaconda3/envs/py35/lib/python3.5/site-packages/tqdm/_tqdm.py", line 1087, in close
File "/home/test/Anaconda3/envs/py35/lib/python3.5/site-packages/tqdm/_tqdm.py", line 439, in _decr_instances
File "/home/test/Anaconda3/envs/py35/lib/python3.5/_weakrefset.py", line 109, in remove
KeyError: <weakref at 0x7f686b4df598; to 'tqdm' at 0x7f686b53cd30>

@Belval
Copy link
Owner

Belval commented Mar 5, 2019

Is the command you pasted, the one you used? -l am does not seem right.

@direselign
Copy link
Author

This is the command that I use
python run.py -w 5 -f 64 -l am
it works with the default, but when I add a new font(Amharic) abbreviated am it is not working

@Belval
Copy link
Owner

Belval commented Mar 5, 2019

Assuming that you added your the language correctly (if you have a branch somewhere I can take a look), the stacktrace seems to indicate that your font file is not a valid .ttf or .otf file. If you want you can load it with Pillow's ImageFont in an interpreter and see if it throws the same exception.

@direselign
Copy link
Author

direselign commented Mar 5, 2019

I check the fonts, there is no problem with the fonts
sample font
AbyssinicaSIL-R.zip

@Belval
Copy link
Owner

Belval commented Mar 6, 2019

This is very weird, I was able to make it work on first try:

_1

See my branch: https://github.com/Belval/TextRecognitionDataGenerator/tree/amharic

@direselign
Copy link
Author

Thank you for your support. I think the problem is not in the code there may be a library that is not working correctly in my environment. After generating three or more images the program terminates.

@Belval
Copy link
Owner

Belval commented Mar 12, 2019

Closing since the issue is not with the project.

@Belval Belval closed this as completed Mar 12, 2019
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

2 participants