Sixdsn / terra-terminal

Terra is a GTK+3.0 based terminal emulator with useful user interface, it also supports multiple terminals with splitting screen horizontally or vertically. New features have been added since September 2013. It's a pretty new and experimental project, if you want to contribute just checkout and try.
GNU General Public License v3.0
7 stars 3 forks source link

Fix: tuple assignment index out of range #95

Closed SchnWalter closed 9 years ago

SchnWalter commented 9 years ago

If you remove the "pseudo-hack" from terra/config.py#L54-L57 then you will get this exception when running

Traceback (most recent call last):
  File "./main/terra", line 27, in <module>
    terra.__main__.main()
  File "/workspace/dev/terra-terminal/terra/__main__.py", line 46, in main
    for section in ConfigManager.get_sections():
  File "/workspace/dev/terra-terminal/terra/config.py", line 54, in get_sections
    return cls.config.sections()
  File "/usr/lib64/python2.7/ConfigParser.py", line 251, in sections
    return self._sections.keys()
  File "/usr/lib64/python2.7/collections.py", line 102, in keys
    return list(self)
IndexError: tuple assignment index out of range

If you remove the binding of the GlobalHotkeys and the exception thrown when the bind is missing, the the whole application works. And it's not related to the ConfigManager as I first thought.

Looks like if you add these 2 blocks of code around self.hotkey.bind(...) then you will see that the first block works, but not the 2nd one.

if global_key_string:
    for item in ['abc', 'def']:
        print(item)
    print('finished printing letters')
    self.bind_success = self.hotkey.bind(global_key_string, lambda w: self.show_hide(), None)
    for item in ['123', '456']:
        print(item)
    print('finished printing numbers')

Output:

/workspace/terra-terminal/main/terra
abc
def
finished printing letters
123
456
Traceback (most recent call last):
  File "./terra-terminal/main/terra", line 27, in <module>
    terra.__main__.main()
  File "./terra-terminal/terra/__main__.py", line 44, in main
    TerraHandler.Wins = TerminalWinContainer()
  File "./terra-terminal/terra/terminal.py", line 44, in __init__
    for item in ['123', '456']:
IndexError: tuple assignment index out of range

But the weird thing is that this happens only when running terra inside another terminal. If I run terra from within my IDE, this works just fine, and I can not find any difference between the environments.

Sixdsn commented 9 years ago

I think there might be a bug in the C code of the binding keys, it looks like something goes wrong in the stack to get that kind of issue... I will like a this