今天在pycharm运行rl_server_no_training.py欲启动服务器时,却出现如下错误
powershell
Traceback (most recent call last):
File "xxx/rl_server_no_training.py", line 333, in <module>
main()
File "xxx/rl_server_no_training.py", line 326, in main
run(log_file_path=LOG_FILE + '_RL_' + trace_file)
File "xxx/rl_server_no_training.py", line 314, in run
httpd = server_class(server_address, handler_class)
File "xx\anaconda\envs\pensieve\lib\SocketServer.py", line 420, in __init__
self.server_bind()
File "xx\anaconda\envs\pensieve\lib\BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "xx\anaconda\envs\pensieve\lib\SocketServer.py", line 434, in server_bind
self.socket.bind(self.server_address)
File "xx\anaconda\envs\pensieve\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10049]
Process finished with exit code 1
这种问题一般是监听的ip地址出现问题了。
上面代码我在本地PC运行,通过win+R,输入cmd,再输入ipconfig
可查询本地ip地址。
对比,发现果然与server_address = ('xxx.xxx.xxx.xxx', port)中的ip地址不一样。
接下来将server_address = ('xxx.xxx.xxx.xxx', port)中的ip地址替换成刚刚查询到的本地ip地址。
没有报错,成功。