I have such short script:
import pygal
if __name__ == '__main__':
bar_chart = pygal.Bar()
and following error: AttributeError: 'module' object has no attribute 'Bar'
Do you have any idea what is wrong? Shall I configure some additional paths? I am using windows.
Thank you
If your script is named
pygal.py
, when youimport pygal
, it's going to import your script, not thepygal
library you installed into your system site-packages. And your script obviously doesn't have a class namedBar
.The solution is simple: rename your script to something different. Like
pygaltest.py
ormypygal.py
.And make sure to look at the directory and see if there's a
pygal.pyc
left behind, which Python compiled from yourpygal.py
. If so, you have to delete that file.