class Door:
def __init__(self, weight):
self.weight = weight
def __str__(self):
return str(self.weight)
# фабричный метод
def door_from_window(cls, window):
# какой-то код
door = Door.door_from_windwow(window)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
Running an example several times with too small delay between executions, could lead to this error:
OSError: [Errno 98] Address already in use
This is because the previous execution has left the socket in a TIME_WAIT state, and can’t be immediately reused.
There is a socket flag to set, in order to prevent this, socket.SO_REUSEADDR:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
the SO_REUSEADDR flag tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire.
eval("{}(user_last_message)".format(callback_data.data))
update-java-alternatives
что бы установить вашу джаву ка дефолтную.List all java versions:update-java-alternatives --list
Set java version as default (needs root permissions):sudo update-java-alternatives --set /path/to/java/version