hholzgra / ocitysmap

Fork of ocitysmap repository at savannah.nongnu.org
Other
35 stars 12 forks source link

Configuration file not read due to hardcoded filename #19

Closed reald closed 2 years ago

reald commented 5 years ago

On more recent branches rendering fails because of a missing config file:

./render.py -t "Test" -b 49.6,10.9835 49.4032,11.2152 -L de_DE.UTF-8 -C /tmp/.ocitysmap.conf -f pdf
DEBUG:ocitysmap:Reading OCitySMap configuration from /tmp/.ocitysmap.conf...
Traceback (most recent call last):
  File "/usr/lib/python3.6/configparser.py", line 1138, in _unify_values
    sectiondict = self._sections[section]
KeyError: 'rendering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./render.py", line 270, in <module>
    sys.exit(main())
  File "./render.py", line 135, in main
    [options.config_file or os.path.join(os.environ["HOME"], '.ocitysmap.conf')])
  File "/home/someuser/src/ocitysmap/ocitysmap/ocitysmap/__init__.py", line 184, in __init__
    self.STYLESHEET_REGISTRY = Stylesheet.create_all_from_config(self._parser)
  File "/home/someuser/src/ocitysmap/ocitysmap/stylelib/__init__.py", line 116, in create_all_from_config
    styles = parser.get('rendering', 'available_'+type)
  File "/usr/lib/python3.6/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.6/configparser.py", line 1141, in _unify_values
    raise NoSectionError(section)
configparser.NoSectionError: No section: 'rendering'

The problem seems to be in ocitysmap/__init__.py:

self._parser.read('/home/maposmatic/.ocitysmap.conf', encoding='utf-8')

The config file is hardcoded so the command line parameter and default values are overwritten.

hholzgra commented 5 years ago

Uh, embarrassing, that should indeed never have slipped through to a public repository ...