0

No output?!

My code wont give me any output for some reason, despite not being able to simply not print.. I have a try-except with prints in both that get ignored for some reason.. Neither of the prints are in if statements or anything to block them, besides errors which my code doesnt have https://code.sololearn.com/c2A140A14857/?ref=app

20th Jun 2021, 3:28 AM
Noah
Noah - avatar
1 Réponse
+ 1
Hi Noah! The first thing I notice is the host and port. It's generally not a good idea to use ports 0-1023 since these are usually used by your system. I messed with the code a little and moved all of the code outside newkey into a function called 'main' and called 'main()' at the bottom and I was able to get output. You're also calling 's.connect(...)' before it is declared, so you will have to move that into the main function as well. But this stuff should fix your problem with not seeing anything. I'm not sure how networking will go on Sololearn, so it might not connect to your local server. You might have to use it on your local PC if you're not already doing so. Hopefully this helped a bit, happy coding!
20th Jun 2021, 11:00 AM
Caleb
Caleb - avatar