selectel / pyte

Simple VTXXX-compatible linux terminal emulator
http://pyte.readthedocs.org/
GNU Lesser General Public License v3.0
658 stars 102 forks source link

Error while trying to ssh into a remote server on Pythonista 3 using Stash #123

Open mbardolia opened 5 years ago

mbardolia commented 5 years ago

I just recently installed Pythonista 3 on my iPad and installed Stash. When trying to ssh into a remote server, I receive the following error:

Exception in thread Thread-98:
Traceback (most recent call last):
  File "/var/containers/Bundle/Application/3B51BA3D-0C95-4DFC-BD6F-9478B30E671D/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/var/containers/Bundle/Application/3B51BA3D-0C95-4DFC-BD6F-9478B30E671D/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "Documents/site-packages/stash/bin/ssh.py", line 135, in stdout_thread
    self.update_screen()
  File "Documents/site-packages/stash/bin/ssh.py", line 142, in update_screen
    _stash.main_screen.load_pyte_screen(self.screen)
  File "/private/var/mobile/Containers/Shared/AppGroup/AADCB172-A760-4CAD-BB1C-21F0308B03B5/Pythonista3/Documents/site-packages/stash/system/shscreens.py", line 577, in load_pyte_screen
    c = pyte_screen.buffer[idx_line][idx_column]
TypeError: list indices must be integers or slices, not float

In reading some other threads I’ve gone through and installed paramiko and wcwidth in an effor to help resolve the issue. Any suggestions/guidance would be appreciated.

superbobry commented 5 years ago

Apologies for the delay. My guess would be that stash uses / division for line/column indices. On Python 3 / always produces a float. The fix is simple: replace it with flooring division //.