Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 To inherit from serverSocket.BaseServer or not?
Quote:Line 201. ...May be extended, do not override."""

This line is from class on the prescribed line. It does NOT work keeps giving an error regarding __is_shutdown not having been defined as an attribute! It does NOT work out of the box and if it's not supposed to be overridden but can be extended then wtf-riday?? Am I interpreting that correctly? I've tried everything I can think of including calling super(). This is for a University project, I need this to function properly!

Cry Cry Cry Exclamation

Using Python 3.7.2 as that is the latest python version I can use with my software...
  • Show code
  • Show error traceback, complete and unaltered
  • Wrap all with bbcode tags
My code:
import socketserver as server
import atexit as exit
import select
import tkinter as tk
from socketserver import _SocketWriter as sockWrite
class RobotTCPServer(server.BaseServer):
    bufferLEN = 4096
    readable = None
    writeable = None
    errorable = None
    address_family = server.socket.AF_INET

    socket_type = server.socket.SOCK_STREAM
    def __init__(self, server_address, chandler): #'weanis'. Go Friends!
        super(type(self), chandler)
        print("Starting server...")
        self.socket = server.socket.socket(self.address_family,
        self.readable, self.writeable, self.errorable =[self.socket],[self.socket],[self.socket],  30)
    def onExit(self):

class Handler(server.BaseRequestHandler):
    timeout = 30
    rbufsize = -1
    wbufsize = 0

    # A timeout to apply to the request socket, if not None.
    timeout = None

    # Disable nagle algorithm for this socket, if True.
    # Use only when wbufsize != 0, to avoid small packets.
    disable_nagle_algorithm = False

    def handle(self): = self.rfile.readline().strip()
        print("{} wrote to:".format(self.client_address[0]))
        print("GOT DATA=\t" +
        self.wfile.write("GOT YOUR MESSAGE.")

class Graphical(tk.Tk):
    frame = None
    def __init__(self, server):
        self.tangoBot = server
        self.frame = tk.Frame(tk.Tk(), width=256, height=128)
        self.frame.bind("<Escape>", self.key)
        self.frame.bind("<Button-1>",  self.callback)
    def mainloop(self):
    def key(self, event):
        print("pressed" +  repr(event.char))

    def callback(self, event):
        print("clicked at", event.x, event.y)
tup = ('',65000)
robotServer = RobotTCPServer(tup, None)
gfx = Graphical(robotServer)
Quote:PS D:\ROBOTICS\controllers\project_3_controller> python .\
Starting server...
Traceback (most recent call last):
File ".\", line 63, in <module>
robotServer = RobotTCPServer(tup, None)
File ".\", line 20, in __init__
File "C:\Users\Jakeeee\AppData\Local\Programs\Python\Python37\lib\", line 222, in serve_forever
AttributeError: 'RobotTCPServer' object has no attribute '_BaseServer__is_shut_down'
PS D:\ROBOTICS\controllers\project_3_controller>

HEY! Nevermind. I got it working! Thank you for your patience. Being sleep deprived produces odd effects on a person...
You are welcome.
Over the years I have solved much while sleeping.
If so inclined, Please share your share your solution with the forum, so others may benefit.

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)