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

IBM AS400 Telnet characters lose or missing #61

Open
javitechjkd opened this issue Feb 3, 2023 · 3 comments
Open

IBM AS400 Telnet characters lose or missing #61

javitechjkd opened this issue Feb 3, 2023 · 3 comments

Comments

@javitechjkd
Copy link

javitechjkd commented Feb 3, 2023

Hello, i hope you are ok.

I am having a issue with chars lose after doing a fwpage using telnetlib3, I don’t know if it is a bug or is not supported with CP1145

this is the program:

import asyncio, telnetlib3, nest_asyncio

nest_asyncio.apply()

host = "as400host"
async def shell(reader, writer):
    while True:
        # read stream until 'User' mark is found
        outp = await reader.read(1024)
        if not outp :
            # End of File
            break
        elif 'User  . . . . . . . . . . . . . .' in outp:
            writer.write('afteruserandpassword\r\r\r\r\rXOP\r2\r\x1B\x5B\x36\x7e') #  
        # display all server output
        print(outp, flush=True)
        
        
    # EOF
    print("Finalizado")

loop = asyncio.get_event_loop()
coro = telnetlib3.open_connection(host, 23, shell=shell,encoding="utf-8", encoding_errors='replace')
reader, writer = loop.run_until_complete(coro)
loop.run_until_complete(writer.protocol.waiter_closed)

I am having this issue with telnetlib and telnetlib3

Can you help me?

@javitechjkd javitechjkd changed the title AS400 Telnet characters lose IBM AS400 Telnet characters lose or missing Feb 3, 2023
@jquast
Copy link
Owner

jquast commented Feb 3, 2023

Try adding await writer.drain() after any writes

@jquast
Copy link
Owner

jquast commented Feb 3, 2023

Try also print(repr(outp)), there could be special terminal sequences like clearing a line or screen that make it seem output is lost

@javitechjkd
Copy link
Author

Hello again. It is possible to use cp1145 with telnetlib3? I have observed that instead Ñ i receive # so maibe this have something within.

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

2 participants