python - IOError: cannot open resource -
I have a code on the iPython notebook, where I am trying to create a wordcloud, but I get an error . What could I see, the error is related to something else and not my code (something with fonts?)
---------------- - ------------------------------------------------- - -------- IOError Tracebacks (Most Recent Call End) & lt; Ipython-input-71-795b92e06f22 & gt; In & lt; Module & gt; () 4 # print x [0], x [1] 5 ---- & gt; 6 GeneWorldClouds (list_of_tuples) & lt; Ipython-input-70-55c34fb2c915 & gt; In GenWordCloud (filename) 15 calculations = filename 16 #words = myWC.fit_words (calculation, width = 500, height = 500) ---> 17 terms = myWC.fit_words (count) 18 myWC.draw (word, pngapath + os.path.splitext (filename) [0] + '. PNG', width = 500, height = 500, scale = 1) returns 19 Cloud is generated for '{}'. Fit_words (self, the word) 177 in the format (file name) /usr/local/lib/python2.7/dist-packages/wordcloud/wordcloud.pyc while true: 178 # Try to find the position - - & gt; 179 font = ImageFont.truetype (self.font_path, font_size) 180 # Optionally 181 if random_state.random () & lt; Self. Prefer_Lohazontal: /usr/local/lib/python2.7/dist-packages/PIL/ImageFont.pyc Try True Type (font, size, index, encoding, filename) 238 239: - & gt; 240 Return FreeType font (font, size, index, encoding) except for IOError 241: 242 if sys.platform == "win32": /usr/local/lib/python2.7/dist-packages/PIL/ImageFont.pyc __init __ In (self, font, size, index, encoding, file) 135 136 if heapath (font): - & gt; 137 self.font = core.getfont (font, size, index, encoding) 138 other: 139 self.font_bite = font.read () IOError: can not open resource
I'm not It is certain how it can be understood. It seems that like a class I am using some fonts, and something happens with some font files
Any insights will be appreciated
I am using it as a base:
You will need to specify font_path in your wordcloud object emulator, author Has changed many things in its latest edition I updated my project according to these changes, you can
Comments
Post a Comment