【发布时间】:2014-06-06 22:02:15
【问题描述】:
我遇到了一个问题,因为我正在尝试使用 telnet 连接到我的树莓派,但是当涉及到它正在读取用户名条目的部分时,我收到了一个错误,我已粘贴在下面。
#IMPORTS
from tkinter import *
import time
import telnetlib
import sys
import getpass
import tkinter.messagebox
#TELNET
user = input("Please Enter Your Username: ")
time.sleep(0.4)
pass_ = input("Please Enter Your Password: ")
bot = telnetlib.Telnet("192.168.1.128")
bot.read_until("login: ")
bot.write(user + "\n")
bot.read_until("Password: ")
bot.write(pass_ + "\n")
bot.write("cd PiBits/ServoBlaster")
#DEFINITIONS
#STUFF
master = Tk()
#LEFT
left = Scale(master,from_=0,to=249,length=550,width=25,tickinterval=152,sliderlength=30)
left.pack()
left.set(152)
left.grid(row=0, column=2)
#RIGHT
right = Scale(master,from_=0,to=249,length=550,width=25,tickinterval=152,sliderlength=30)
right.pack()
right.set(152)
right.grid(row=0, column=12)
#MIDDLE
mid = Scale(master,from_=0,to=249,length=550,width=25,tickinterval=152,sliderlength=30)
mid.pack()
mid.set(152)
mid.grid(row=0, column=7)
#RUN CANVAS
mainloop()
我收到以下错误消息:
Traceback (most recent call last):
File "/Users/kiancross/Desktop/PROJECTS/RASPBERRY_PI/ROBOT/CONTROLLER_GUI/RPi_BOT_CONTROLLER.py", line 16, in <module>
bot.read_until("login: ", timeout=NONE)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/telnetlib.py", line 304, in read_until
i = self.cookedq.find(match)
TypeError: Type str doesn't support the buffer API
请有人告诉我为什么会收到错误消息以及如何修复它?
谢谢
【问题讨论】:
标签: python macos raspberry-pi telnet