重启时 pep381run 损坏:httplib.ResponseNotReady [英] pep381run broken when restart: httplib.ResponseNotReady

查看:65
本文介绍了重启时 pep381run 损坏:httplib.ResponseNotReady的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置本地 pypi 服务器.我使用 pep381client 来同步官方 PYPI 服务器.

I'm trying to setup a local pypi server. I use pep381client to synchronize the official PYPI server.

它工作正常.但是今天我遇到了一个问题:我停止(按 Ctr+C)它然后重新启动,pep381run 引发错误如下:

It works fine. But today I encountered a problem: I stop (by Ctr+C) it and then restart , pep381run raise error as the following:

E:\tmp>pep381run.py pypi
Synchronizing OBITools
Copying /packages/source/O/OBITools/OBITools-0.2.000.tar.gz
Copying /packages/source/O/OBITools/OBITools-0.2.002.tar.gz
Copying /packages/source/O/OBITools/OBITools-00.02.503.tar.gz
Copying /packages/source/O/OBITools/OBITools-00.02.500.tar.gz
Traceback (most recent call last):
  File "D:\Python27\Scripts\pep381run.py", line 31, in <module>
    state.synchronize()
  File "D:\Python27\lib\site-packages\pep381client\__init__.py", line 119, in synchronize
    self._synchronize()
  File "D:\Python27\lib\site-packages\pep381client\__init__.py", line 159, in _synchronize
    self.maybe_copy_file(project, file)
  File "D:\Python27\lib\site-packages\pep381client\__init__.py", line 237, in maybe_copy_file
    r = h.getresponse()
  File "D:\Python27\lib\httplib.py", line 1033, in getresponse
    raise ResponseNotReady()
httplib.ResponseNotReady  

有什么想法吗?

推荐答案

由这个问题提醒,在对代码进行肮脏而绝望的更改后,如下所示:

Reminded by this question , after making a dirty and desperate change to the code as the following:

def http():
    global _conn
    _conn = httplib.HTTPSConnection(pypi) 
    _conn.connect()
    return _conn

它又起作用了.

这篇关于重启时 pep381run 损坏:httplib.ResponseNotReady的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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