You are trying to make some modules optional, e.g. GConf. So if the package is not available, terminator should still work.
We used to have:
try:
import gi
from gi.repository import GConf
except ImportError:
dbg('Unable to import gconf, GNOME defaults unavailable')
If gi or GConf are not available, that throws an ImportError, which you catch and handle, so everything is fine, and you continue to run without GConf.
However, we now have:
try:
import gi
gi.require_version('GConf','2.0')
from gi.repository import GConf
except ImportError:
dbg('Unable to import gconf, GNOME defaults unavailable')
If you don't have GConf, that will fail on gi.require_version, which will throw a ValueError. Since ValueError is not handled, we crash:
emilio@tatooine:~/src/terminator-gtk3$ ./terminator
Traceback (most recent call last):
File "./terminator", line 47, in <module>
import terminatorlib.optionparse
File "/home/emilio/src/terminator-gtk3/terminatorlib/optionparse.py", line 25, in <module>
import config
File "/home/emilio/src/terminator-gtk3/terminatorlib/config.py", line 84, in <module>
gi.require_version('GConf','2.0')
File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 118, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GConf not available
Handling both ImportError and ValueError explicitly would be fine as well indeed.
You are trying to make some modules optional, e.g. GConf. So if the package is not available, terminator should still work.
We used to have:
try:
import gi
from gi.repository import GConf
except ImportError:
dbg('Unable to import gconf, GNOME defaults unavailable')
If gi or GConf are not available, that throws an ImportError, which you catch and handle, so everything is fine, and you continue to run without GConf.
However, we now have:
try: require_ version( 'GConf' ,'2.0')
import gi
gi.
from gi.repository import GConf
except ImportError:
dbg('Unable to import gconf, GNOME defaults unavailable')
If you don't have GConf, that will fail on gi.require_version, which will throw a ValueError. Since ValueError is not handled, we crash:
emilio@ tatooine: ~/src/terminato r-gtk3$ ./terminator optionparse emilio/ src/terminator- gtk3/terminator lib/optionparse .py", line 25, in <module> emilio/ src/terminator- gtk3/terminator lib/config. py", line 84, in <module> require_ version( 'GConf' ,'2.0') python2. 7/dist- packages/ gi/__init_ _.py", line 118, in require_version 'Namespace %s not available' % namespace)
Traceback (most recent call last):
File "./terminator", line 47, in <module>
import terminatorlib.
File "/home/
import config
File "/home/
gi.
File "/usr/lib/
raise ValueError(
ValueError: Namespace GConf not available
Handling both ImportError and ValueError explicitly would be fine as well indeed.
Hope that's clearer.