pythonpython-3.xpycharmpygal

Cannot import COUNTRIES module from pygal_maps_world


I know that there are similar questions but the answers are outdated and non-working by now (answers are all circa 2016). I have installed pygal_maps_world using pip but when I want to import a module it just shows me an error message.

Code:

from pygal.maps.world import COUNTRIES

Error message:

Cannot find reference 'world' in '__init__.py'

Solution

  • I have found an answer, for anybody having the same problem. You have to install pygal_maps_world, and then in your project directory go to venv/lib/site-packages/pygal_maps_world and there is a file called i18n. The COUNTRIES module is in file i18n.py:

    from pygal_maps_world.i18n import COUNTRIES