python - AttributeError: 'NoneType' object has no attribute 'show' -


i want pdf file, error: attributeerror: 'nonetype' object has no attribute 'show'. error says can doesn't have attribute show. why? can see, import show pychart.canvas.

from pychart import * pychart.canvas import show can = canvas.init("pic.pdf") x, y = (100, 500)  def show_text(str):     global x, y     can.show(x, y, str)     can.show(x + 200, y, "/12/c" + font.quotemeta(str))     y -= 20  show_text("/12/hlleft align") show_text("/12/hrright align") show_text("/12/hccenter align") show_text("/a20/12/hrangled text")  def show_textv(str):     global x, y     can.show(x, y, str)     x += 150  y -= 40 x = 100 show_textv("/12/vt//12//vttop align") show_textv("/12/vm//12//vt/12middle align") show_textv("/12/vb//12//vt/12bottom align")  y -= 40 x = 100 show_text("/16/hhelvetica") show_text("/12/ccourier") show_text("/12/nhelvetica-narrow") show_text("/12/ppalatino-roman") show_text("/12/aavantgarde") show_text("/12/t/itimes-italic") show_text("/12/f{zapfdingbats}zapfdingbats") 

nonetype type of none object. when can == none , call following:

can.show(x, y, str) 

you call none.show(x, y, str) , attributeerror, because none doesn't have 'show' attribute

to fix problem try investigate why can == none


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -