[問題] threading / read from pipe的內容不完整

看板Python作者 (我抓得到什麼呢?)時間13年前 (2011/07/13 10:17), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
呃... 我也覺得標題很爛, 請大家提示一下要怎麼下這個標題吧 <(_ _)> 我現在想要寫一個ptt(bbs)的wraper 用ssh連線,現在還在很原始的階段,code在下面 當沒有綠色的部份(讓ssh直接寫到tty)時,bbs的操作是OK的 可是加上後,會在一個螢幕還沒畫完時就卡著 操作的指令還有用,可是畫面會很亂 不知到是ssh還是python被block, 還是? os:linux, python3.1.2 ---------------- bbs=['ssh', 'bbsu@ptt.cc'] import sys, tty, subprocess, threading #為了放進一頁的ptt Conn=subprocess.Popen(bbs, stdin=subprocess.PIPE, # stdout=subprocess.PIPE, stderr=subprocess.STDOUT) def reading(): while True: scr=Conn.stdout.read(1) drop=sys.stdout.buffer.write(scr) #DataIn=threading.Thread(target=reading) #DataIn.start() tty.setraw(1) while True: char=sys.stdin.buffer.read(1) drop=Conn.stdin.write(char) Conn.stdin.flush() -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.245.32
文章代碼(AID): #1E7G0TEb (Python)
文章代碼(AID): #1E7G0TEb (Python)