piqueserver / pyenet

A python wrapper for the ENet library (this fork is the source for the pypi package)
BSD 3-Clause "New" or "Revised" License
13 stars 6 forks source link

TypeError when create server. #7

Closed Furkan125 closed 3 years ago

Furkan125 commented 3 years ago

Hi, i try to create server with pyenet but i got this error:

host = enet.Host(enet.Address("localhost", 33333), 1, 0, 0)

File "enet.pyx", line 262, in enet.Address.init File "enet.pyx", line 296, in enet.Address.host.set TypeError: expected bytes, str found

My code:

import enet

host = enet.Host(enet.Address("localhost", 33333), 1, 0, 0)
event = host.service(0)
godwhoa commented 3 years ago

"localhost" -> b"localhost" https://docs.python.org/3/howto/pyporting.html#text-versus-binary-data Looks like the README examples need to be updated for Python 3. PRs welcome!

Furkan125 commented 3 years ago

Yes, its README example. By the way its worked tysm.