<div dir="ltr"><div>Hi all, (sorry for double posting the previous email was accidentally sent )<br></div><div><br></div><div>I have been using pylxd to interact LXD REST API. I create a container and then send</div><div>the /bin/bash cmd using the raw_interactive_execute function. <br></div><div>Concretely here is my function call</div><div><br></div><div>res = container.raw_interactive_execute(['/bin/bash', ], environment={"TERM":"xterm"})</div><div>I got back the websocket secret and the control. So far so good. I am opening a websocket to</div><div>interact with the container as follows:</div><div><br></div><div>websocket.enableTrace(False)<br>ws = websocket.WebSocketApp(uri,<br>                                    on_message=on_message,<br>                                    on_error=on_error,<br>                                    on_close=on_close,<br>                                    on_open=on_open)<br><br>    ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}, ping_interval=0, ping_timeout=0)<br>    ws.close()</div><div><br></div><div>Here is also the on_open</div><div><br></div><div>def on_open(ws):<br>        def run(*args):<br>          <br></div><div>               while True:<br>                                            cmd = get_user_input()<br>                      cmd += "\r"<br>                                         print("Sending CMD: ", cmd)<br>                                            cmd = bytearray(cmd, encoding='utf-8')<br>                      ws.send(cmd, opcode=2)<br>                                        time.sleep(1)<br><br>                             print("Closing connection...")<br>                            ws.close()<br>                                 print("thread terminating...")<br>               thread.start_new_thread(run, ())</div><div><br></div><div>I then open the control as follows <br></div><div><br></div><div>uri = 'some_uri_generated'<br>websocket.enableTrace(False)<br> ws = websocket.WebSocketApp(uri,<br>                                                                                                            on_message=on_message,<br>                                                                                                              on_error=on_error,<br>                                                   on_close=on_close)<br><br> ws.on_open = on_open<br>  ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}, ping_interval=0, ping_timeout=0)</div><div><br></div><div>where the on_open now is</div><div><br></div><div>def on_open(ws):<br>    def run(*args):<br>        print("Connected....")<br>                <br>        while True:<br><br>            cmd = get_user_input()<br>            cmd = cmd.lstrip()<br>            cmd = cmd.rstrip()<br>            if cmd == 'Exit':<br>                break<br><br>            width = cmd.split(',')[0]<br>            height = cmd.split(',')[1]<br><br>            data = "{'command':'window-resize'," \<br>                                "'args':'{'width': '%s', " \<br>                                "'height':'%s'}}'" % (width, height)<br>                        <br>            print("control data: ", data)<br>            cmd = bytearray(data, encoding='utf-8')<br>            ws.send(data, opcode=2)<br>            #ws.send(data)<br>            time.sleep(1)<br><br>        print("Closing connection...")<br>        ws.close()<br>        print("thread terminating...")<br>    thread.start_new_thread(run, ())</div><div class="gmail-adL"><br></div><div class="gmail-adL">I then fire up two terminals. One that runs the interaction with the container and one that has the control. However when I sent the control with some given width and height and then go on the interaction terminal and send tput cols or tput lines nothing has changed. Am I missing sth here or I am doing sth completely wrong and meaningless?</div><div class="gmail-adL"><br></div><div class="gmail-adL">Thanks in advance and I am sorry for double posting.</div><div class="gmail-adL">Best</div><div class="gmail-adL">Alex<br></div><div class="gmail-adL"><br></div></div>