运行时警告-Greenlet.greenlet大小已更改??

时间:2018-07-24 10:40:11

标签: python

我正在运行一个模块,可以在这里找到:https://github.com/danieliu/play-scraper

我在python文件中的代码如下:

导入play_scraper

print(play_scraper.collection(
      collection='TOP_FREE',
      category='COMMUNICATION',
      results=5,
      page=1))

我不太了解终端中的错误消息,也不确定如何或在何处搜索以继续前进。

File "app-store-scraper.py", line 1, in <module>
    import play_scraper
ImportError: No module named play_scraper
Sams-MacBook-Air-2:cm-leadgen samframpton$ python3 app-store-scraper.py
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/grequests.py:21: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/util/__init__.py)', 'urllib3.contrib.pyopenssl (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py)']. 
  curious_george.patch_all(thread=False, select=False)
Traceback (most recent call last):
  File "app-store-scraper.py", line 7, in <module>
    page=1))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/play_scraper/api.py", line 41, in collection
    return s.collection(collection, category, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/play_scraper/scraper.py", line 394, in collection
    response = send_request('POST', url, data, params)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/play_scraper/utils.py", line 124, in send_request
    allow_redirects=allow_redirects)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 503, in request
    prep.url, proxies, stream, verify, cert
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 676, in merge_environment_settings
    env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/utils.py", line 760, in get_environ_proxies
    if should_bypass_proxies(url, no_proxy=no_proxy):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/utils.py", line 744, in should_bypass_proxies
    bypass = proxy_bypass(parsed.hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2610, in proxy_bypass
    return proxy_bypass_macosx_sysconf(host)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2587, in proxy_bypass_macosx_sysconf
    return _proxy_bypass_macosx_sysconf(host, proxy_settings)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2560, in _proxy_bypass_macosx_sysconf
    hostIP = socket.gethostbyname(hostonly)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gevent/_socketcommon.py", line 163, in gethostbyname
    return get_hub().resolver.gethostbyname(hostname)
  File "src/gevent/_hub_local.py", line 73, in gevent.__hub_local.get_hub_noargs
  File "src/gevent/_hub_local.py", line 80, in gevent.__hub_local.get_hub_noargs
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gevent/hub.py", line 390, in __init__
    WaitOperationsGreenlet.__init__(self, None, None)
  File "src/gevent/_greenlet_primitives.py", line 42, in gevent.__greenlet_primitives.TrackedRawGreenlet.__init__
SystemError: /Users/sysadmin/build/v3.7.0/Objects/dictobject.c:1439: bad argument to internal function
Sams-MacBook-Air-2:cm-leadgen samframpton$ 

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:7)

对于那些收到以下错误消息的人。 您可能遇到了gevent和greenlet库更新引起的问题。

RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)

有关更多详细信息,请参见下文。 https://github.com/gevent/gevent/issues/1260

据报道,绿色小事件gunicorn中的兼容版本(对我有用)

gunicorn==19.9.0
gevent==1.3.4
greenlet==0.4.13

下面还有其他报道也可能有效(我尚未测试过)。

gevent==20.9.0
greenlet==0.4.17