+ 7
[Python] Takes One Argument ??? Please Help Me To Fix It 😢
Python Networking is one of python advanced levels I'm new at this level so I have a question , if you are someone who took a look at python networking of course your remember the "bind((host, port))" right ? so what I'm trying to do here is to use qpython3 app to build my apps but the problem here that it tells me that it needs a tuple for the "bind()" I tried to make a tuple but didn't work and it tells me "bind() takes exactly a one argument" it works for me on SoloLearn's Playground but not on qpython
9 Antworten
+ 8
@Niawahta i tried i removed the help.txt statement it's just the loops ( time limit exceeded) :p but I'm talking about the bind() statement in SoloLearn it works but not on qpython I don't know why
+ 7
here's my code for this question https://code.sololearn.com/cbyV3B1cF03T/?ref=app
+ 7
@LunarCoffee I will tell you what is the error when I write the code like this:
server.bind((host, port))
it tells me this error:
bind takes exactly one argument 2 given
but when I write like this:
server.bind(host) or something like that :p
it tells me
it should be a tuple
+ 7
@LunarCoffee by the way I tried to set the host and the port as a tuple like this:
host = server.gethostname()
port = 9999
tuple = (host, port)
+ 6
@LunarCoffee do you see all of this code it works on SoloLearn but not on "qpython3" ( Python 3 Environment For Android ) qpython is weird cause sometimes when you ask it for an example it will show you but when you compile it ( Run ) it doesn't work and sometimes it doesn't support the socket module objects too much as SoloLearn does I tried the thing that you did but it won't work on qpython just works on SoloLearn
+ 4
Remove the open help.txt statement. Traceback info is quite useful, you know. Also, networking! :D
+ 3
It works for me, in QPython. Look at the info in the traceback error, and post please, thanks. (oh yeah, also, name change)
+ 3
Hm... it should work with socket.bind((host, port)). Weird. Well... sorry. EDIT: Maybe try removing the variable declaration, just put the statement. You shouldn't need a variable for that. So that line should be:
server.bind((host_name, port))
instead of:
host_info = server.bind((host_name, port)).
+ 2
Well, I can do things with the socket module in QPython3, I dunno what's up. I can host my chat server (in development) and run the client on a new terminal process at the same time. Weird.