OSError:[WinError 10013]试图以其访问权限禁止的方式访问套接字 [英] OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

查看:651
本文介绍了OSError:[WinError 10013]试图以其访问权限禁止的方式访问套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Huey用作跨平台任务队列.我找到了 https://github.com/pjcunningham/flask-huey-example,我已经克隆并设置了一个虚拟环境来使用conda(我正在Windows上工作).我遵循了更新的自述文件,并设法使所有三个窗口正常运行.但是,当我打开 http://localhost时: 6060/

I'm experimenting with the use of Huey as a cross platform task queue . I've found https://github.com/pjcunningham/flask-huey-example , which I've cloned and set up a virtualenv for using conda (I'm working on windows). I've followed the updated readme and have managed to get all three windows running without error.However when I open http://localhost:6060/

[![在此处输入图片描述] [2]] [2]

[![enter image description here][2]][2]

我单击发送按钮,这中断了Huey_consumer进程:

I click on the send button and this breaks the Huey_consumer process :

$ python ...envs/hueytest1/Scripts/huey_consumer.exe run_huey.huey
[2018-08-06 10:19:25,949] INFO:huey.consumer:MainThread:Huey consumer started with 1 thread, PID 1704
[2018-08-06 10:19:25,949] INFO:huey.consumer:MainThread:Scheduler runs every 1 seconds.
[2018-08-06 10:19:25,949] INFO:huey.consumer:MainThread:Periodic tasks are enabled.
[2018-08-06 10:19:25,950] INFO:huey.consumer:MainThread:UTC is enabled.
[2018-08-06 10:19:25,950] INFO:huey.consumer:MainThread:The following commands are available:
+ send_async_email
+ dummy_task
[2018-08-06 10:19:39,743] INFO:huey.consumer.Worker:Worker-1:Executing queuecmd_send_async_email: ba5e092d-b1de-41cd-8b27-72d11c2b13d8
[2018-08-06 10:19:40,766] ERROR:huey.consumer.Worker:Worker-1:Unhandled exception in worker thread
Traceback (most recent call last):
  File "...\envs\hueytest1\lib\site-packages\huey\consumer.py", line 153, in process_task
    self.huey.execute(task)
  File "...\envs\hueytest1\lib\site-packages\huey\api.py", line 271, in execute
    result = task.execute()
  File "...\envs\hueytest1\lib\site-packages\huey\api.py", line 565, in execute
    return func(*args, **kwargs)
  File "E:\ENVS\r3\hueytest1\app\tasks.py", line 23, in send_async_email
    mail.send(msg)
  File "...\envs\hueytest1\lib\site-packages\flask_mail.py", line 491, in send
    with self.connect() as connection:
  File "...\envs\hueytest1\lib\site-packages\flask_mail.py", line 144, in __enter__
    self.host = self.configure_host()
  File "...\envs\hueytest1\lib\site-packages\flask_mail.py", line 158, in configure_host
    host = smtplib.SMTP(self.mail.server, self.mail.port)
  File "...\envs\hueytest1\lib\smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "...\envs\hueytest1\lib\smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "...\envs\hueytest1\lib\smtplib.py", line 307, in _get_socket
    self.source_address)
  File "...\envs\hueytest1\lib\socket.py", line 724, in create_connection
    raise err
  File "...\envs\hueytest1\lib\socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

如何使它正常工作?

推荐答案

尝试启动Visdom服务器时,我得到了完全相同的错误:

I got exact same error when trying to start Visdom server:

OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

原因是,还有另一个进程使用与Visdom要使用的端口相同的端口,在我的情况下是端口8097.

The reason was that there was another process using the same port as Visdom wanted to use which in my case is port 8097.

要对此进行调试,请按照以下步骤操作:

To debug this I followed these steps:

  1. 使用来自Sysinternals的TcpView 使用端口查找进程.
  2. 如果该过程为svchost.exe,则需要查找使用此端口的服务.为此,请运行以下命令:`tasklist/svc/FI"PID eq 1234",其中您从TcpView中看到的PID代表1234.
  3. 打开Windows服务小程序并查找此服务器.在我的情况下,这实际上是交付优化"或DOSvc服务,如果您在大型网络上,则该服务基本上使用Windows Update位的P2P下载.我暂时关闭了该服务,并能够再次打开端口.
  1. Use TcpView from Sysinternals to find the process using the port.
  2. If the process turns out to be svchost.exe then you need to find the service that uses this port. To do this run the command: `tasklist /svc /FI "PID eq 1234" where replce 1234 from PID you see in TcpView.
  3. Open Windows Services applet and look for this server. In my case this turned out to be "Delivery Optimization" or DOSvc service which basically uses P2P download of Windows Update bits if you are on large network. I turned off that service temporarily and able to open the port again.

这篇关于OSError:[WinError 10013]试图以其访问权限禁止的方式访问套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆