geom/app.py: ConfigParser py2/py3 fix

When running the viewer app in python3, I got the following crash:
Traceback (most recent call last):
  File "geom_app.py", line 2, in <module>
    ifcopenshell.geom.app.application().start()
  File "/usr/lib/python3/dist-packages/ifcopenshell/geom/app.py", line 534, in __init__
    self.editor = code_edit(self.canvas, configuration().options('snippets'))
  File "/usr/lib/python3/dist-packages/ifcopenshell/geom/app.py", line 68, in __init__
    config = Cfg()
TypeError: 'ConfigParser' object is not callable

Unify configparser usage for py2 and py3 by making sure the py3 path
also gives a callable Cfg
This commit is contained in:
Anders Granskogen Bjørnstad
2017-11-01 10:44:08 +01:00
committed by Thomas Krijnen
parent 352b14f07d
commit f3e20ae450
@@ -51,7 +51,7 @@ class configuration(object):
Cfg = ConfigParser.RawConfigParser
except:
import configparser
Cfg = configparser.ConfigParser(interpolation=None)
Cfg = lambda: configparser.ConfigParser(interpolation=None)
conf_file = os.path.expanduser(os.path.join("~", ".ifcopenshell", "app", "snippets.conf"))
if conf_file.startswith("~"):