Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on CSI sequence with "'" in the Intermediate bytes #192

Open
Floris497 opened this issue Mar 12, 2025 · 0 comments
Open

Error on CSI sequence with "'" in the Intermediate bytes #192

Floris497 opened this issue Mar 12, 2025 · 0 comments

Comments

@Floris497
Copy link

Floris497 commented Mar 12, 2025

So I am using pyte to connect to an OpenVMS terminal and this sequence of bytes causes a problem (when opening the text editor)

This is a small preview of the data that causes an issue for me, and how to reproduce the error

import pyte
screen = pyte.Screen(80, 24)
stream = pyte.ByteStream()
stream.use_utf8 = False
stream.attach(screen)
stream.feed(bytes.fromhex("0d0a1b5c9b306d9b32306c1b29300f1b2a3c1b7d9b6d9b324a9b3f336c9b3b3234729b346c1b3d9b3f366c9b3f376c9b4d9b313b32277a9b313b33277b9b32343b489b4a9b4b9b32313b3830481b5b314a9b3b485b456e64206f662066696c655d9b4b9b3232"))

Causes the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.11/site-packages/pyte/streams.py", line 424, in feed
    super(ByteStream, self).feed(data_str)
  File "/opt/homebrew/lib/python3.11/site-packages/pyte/streams.py", line 205, in feed
    taking_plain_text = send(data[offset:offset + 1])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pyte/streams.py", line 213, in _send_to_parser
    return self._parser.send(data)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pyte/streams.py", line 355, in _parser_fsm
    csi_dispatch[char](*params)
TypeError: Screen.cursor_to_column() takes from 1 to 2 positional arguments but 3 were given

With the help of ChatGPT I was able to understand that there are ' in the CSI sequence
for instance: "1;3'{"
but I cannot find out why they are there. does anyone have an idea and maybe a way to solve this nicely?

I copied this code and replaced "$" with "'" and that does prevent the error from showing. but I do not really understand if that just ignores the whole sequence?

pyte/pyte/streams.py

Lines 341 to 345 in 636b679

elif char == "$":
# XTerm-specific ESC]...$[a-z] sequences are not
# currently supported.
yield None
break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant