Ironislife 98
Ironislife 98

Reputation: 45

"SyntaxError: unexpected EOF while parsing" with pygame and sockets

I am making a pygame LAN game and encountered this error

The code is hosted on github: https://github.com/EmilioMendoza98/LANGame

I get the error "SyntaxError: unexpected EOF while parsing" on line 58 for the client and line 66 on the server

I am fairly new to both pygame and sockets so I am completely in the dark here how do I fix this?

Upvotes: 1

Views: 424

Answers (1)

punter147
punter147

Reputation: 312

I have run your code and had made some changes in multiple files. I have raised a pull request against your repository. Please check that out. A brief explanation of why this is happening is found in this post. The data that you are receiving from the socket is an incomplete/incorrect python statement. It depends on the particular situation, but I could see the error throwing as the data coming from the socket read as 2pos, which is where eval() throws the error. Apologise for not explaining it clearly, but in the process of explaining it clearly I will be making assumptions that are not true in the current code. Therefore, please check my PR against your repository.

Upvotes: 1

Related Questions