0

I try executing code example from snakepit-game game_loop_process.py

but I get this exception

Traceback (most recent call last):
  File "D:\Anaconda3\lib\asyncio\base_events.py", line 1043, in create_server
    sock.bind(sa)
OSError: [WinError 10048] 一次只能用一個通訊端位址 (通訊協定/網路位址/連接埠)。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "D:\Anaconda3\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "D:\Anaconda3\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\Anaconda3\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "D:\Anaconda3\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "D:\Anaconda3\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "D:\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\testarea\game_loop_process.py", line 99, in <module>
    web.run_app(app,host='127.0.0.1',port=1234)
  File "D:\Anaconda3\lib\site-packages\aiohttp\web.py", line 457, in run_app
    asyncio.gather(*server_creations, loop=loop)
  File "D:\Anaconda3\lib\asyncio\base_events.py", line 466, in run_until_complete
    return future.result()
  File "D:\Anaconda3\lib\asyncio\base_events.py", line 1047, in create_server
    % (sa, err.strerror.lower()))
OSError: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 1234): 一次只能用一個通訊端位址 (通訊協定/網路位址/連接埠)。
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Anaconda3\lib\multiprocessing\spawn.py", line 99, in spawn_main
    new_handle = reduction.steal_handle(parent_pid, pipe_handle)
  File "D:\Anaconda3\lib\multiprocessing\reduction.py", line 87, in steal_handle
    _winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] 存取被拒。

what am I doing wrong ?? environment : win10 python version :Python 3.6.1 |Anaconda 4.4.0 (64-bit)|

1 Answer 1

1
OSError: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 1234): 一次只能用一個通訊端位址 (通訊協定/網路位址/連接埠)。

It seems this says you cannot bind the port for the server to listen to it. The error message (in chinese) comes from your system, and says: "Only one communication address (protocol / network address / port) can be used at a time."

Apparently there is another program binding a server to this port, and it is most likely another instance of your program. Make sure to terminate any other instances of it, or choose another port.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.