-
Notifications
You must be signed in to change notification settings - Fork 128
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
font issue with pygame #6
Comments
More investigation shows that the error is only thrown if the size of the word_frequencies list is too large. For example, when I limit it to 300 words, then the font error is not thrown. I wonder if somewhere in the middle of my list there are special characters that are not available in the packaged fonts...? |
I had a similar error when adapting the example to my own problem: In [7]: Exception in Tkinter callback Here is my code: I will try to limit the number of tokens... |
Can you check if https://github.com/atizo/PyTagCloud/commits/master8361a4d1f3a1a22a87b23f0787242d0ac6181618 fixes your problem? Thanks! |
Thank you aeby, I will check it! |
Hello everybody! I have the get the same error when I give as input a text sequence too big: IOError: unable to read font file '/pytagcloud-0.3.5/pytagcloud/fonts/nobile.ttf' I modified init.py with b19d236, but I still get the same error.. Any help is really appreciated! |
Same error here. Still can't find a way to workaround this issue. create_tag_image(tags, str(cluster_id) + '_wordcloud.png', size=(900, 700)) Traceback (most recent call last): |
Still getting this same error. Is there a solution anywhere? |
From what I gathered, this seems to be a problem with input data. I tested with normal words and was able to run it against 1000s of words but it does fail with that error for some data. Not sure what trips it though. |
The problem seems to be too many open files. As
The number of files fits well with the size of the FONTS variable. However, |
An evil workaround is suggested here: https://stackoverflow.com/questions/25944211/how-do-i-close-files-in-python-when-i-havent-got-the-file-identifiers |
I had this error appearing randomly in a cloud generation loop (independent of which cloud was generated it seems)
After investigation it also seemed to me it was too many open files as stated by @fnielsen |
…or repeated reloads of the same font. This fixed an issue I had with it crashing when repeatedly rendering the same cloud in a loop. This may also fix atizo/PyTagCloud#6
This might not be a pytagcloud issue per se... but here goes.
I'm getting a IO error related to the font filenames. I assume it's a pygame problem:
Traceback (most recent call last):
File "/home/blake/Dropbox/2012.03_WorkCode/tagcloud.py", line 41, in
File "/usr/local/lib/python2.7/dist-packages/pytagcloud/init.py", line 344, in create_tag_image
File "/usr/local/lib/python2.7/dist-packages/pytagcloud/init.py", line 275, in _draw_cloud
File "/usr/local/lib/python2.7/dist-packages/pytagcloud/init.py", line 62, in init
IOError: unable to read font filename
When I run the example code off your site, it runs though without a problem. I just can't figure out for the life of me why my code, which uses the same font as the example, won't run.
Here's my code......
import csv
from pytagcloud import create_tag_image, make_tags
from pytagcloud.lang.counter import get_tag_counts
input_csv = csv.reader(open('sql_output.csv','rb'),delimiter="~")
....[some stuff here that creates a list of word frequency tuples from my csv data]
word_frequencies = []
for n,irecord in enumerate(sorted(word_freqs.items(), key=lambda item: item[1])):
word_frequencies.append(tuple([irecord[0],irecord[1]]))
tags = make_tags(word_frequencies, maxsize=120)
create_tag_image(tags, 'cloud_large2.png', size=(900, 600), fontname='Lobster')
The text was updated successfully, but these errors were encountered: