gshell icon indicating copy to clipboard operation
gshell copied to clipboard

Error running gshell commands - IndexError: list index out of range.

Open rishiravi17 opened this issue 3 years ago • 2 comments

Hello

I am getting below given errors on executing gshell commands like gshell cd --with-id FILEID. Only commands that work is, gshell init or gshell info --with-id FILEID. Otherwise I am always getting these errors.

I tried on Centos 7 & Ubuntu 20. In an older instance of Centos 7, I was able to execute all commands and get results, which has the same Python versions as in the latest Centos 7 spin up instances. Could you please share some light on what could be wrong?

Traceback (most recent call last): File "/home/centos/.local/bin/gshell", line 8, in sys.exit(main()) File "/home/centos/.local/lib/python3.6/site-packages/gshell/init.py", line 543, in main cli() File "/home/centos/.local/lib/python3.6/site-packages/click/core.py", line 1128, in call return self.main(*args, **kwargs) File "/home/centos/.local/lib/python3.6/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/centos/.local/lib/python3.6/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/centos/.local/lib/python3.6/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/centos/.local/lib/python3.6/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/centos/.local/lib/python3.6/site-packages/gshell/init.py", line 407, in cmd_cd cwd = getcwd() File "/home/centos/.local/lib/python3.6/site-packages/gshell/init.py", line 106, in getcwd return init_config() File "/home/centos/.local/lib/python3.6/site-packages/gshell/init.py", line 97, in init_config home_id = _get_home_id() File "/home/centos/.local/lib/python3.6/site-packages/gshell/init.py", line 89, in _get_home_id parent_id = lines[1][start:end].strip() IndexError: list index out of range

Ubuntu:

Traceback (most recent call last): File ".local/bin/gshell", line 8, in sys.exit(main()) File "/home/ubuntu/.local/lib/python3.8/site-packages/gshell/init.py", line 543, in main cli() File "/usr/lib/python3/dist-packages/click/core.py", line 764, in call return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/home/ubuntu/.local/lib/python3.8/site-packages/gshell/init.py", line 131, in cmd_init config_dir = init(name) File "/home/ubuntu/.local/lib/python3.8/site-packages/gshell/init.py", line 58, in init init_config() File "/home/ubuntu/.local/lib/python3.8/site-packages/gshell/init.py", line 97, in init_config home_id = _get_home_id() File "/home/ubuntu/.local/lib/python3.8/site-packages/gshell/init.py", line 89, in _get_home_id parent_id = lines[1][start:end].strip() IndexError: list index out of range

Appreciate your help on this. Thank you.

rishiravi17 avatar Apr 07 '22 14:04 rishiravi17

Potentially this is because you don't have anything under your gdrive folder.

You can try to print the cmd and stdout in /home/ubuntu/.local/lib/python3.8/site-packages/gshell/init.py to debug it.

AlbertHuyb avatar Jul 24 '22 03:07 AlbertHuyb

For me this was related to not having anything in my home folder (even though I had a file shared with me). Perhaps a quick check could be added so that it fails more gracefully.

duerrsimon avatar Aug 04 '22 21:08 duerrsimon