Ask coding questions

← Back to all posts
What am I doing wrong?
imightbenutella (3)

Hi, I've been trying to create this chatroom but unfortunately I keep running into errors. The first one was:

 No such file: main.py
repl process died unexpectedly: exit status 2 

So I tried re-naming the one of the files (client.py). Then, it gave me this error:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    ip = socket.gethostname(server_host)
TypeError: gethostname() takes no arguments (1 given)
 

Here's line 3-6:

socket_server = socket.socket()
server_host = socket.gethostname()
ip = socket.gethostname(server_host)
sport = 8080

Can someone please explain what I am doing wrong?

Comments
hotnewtop
[deleted]

On line 5 you must write ip = socket.gethostname()