- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试集成youtrack进入sentry使用this插件。
问题是当我们单击更多 --> 创建 YouTrack 问题时,页面似乎挂起。查看系统日志,我看到了这个:
Traceback (most recent call last):
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/views/generic/base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/utils/decorators.py", line 29, in _wrapper
return bound_func(*args, **kwargs)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/utils/decorators.py", line 25, in bound_func
return func(self, *args2, **kwargs2)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/web/frontend/base.py", line 172, in dispatch
return self.handle(request, *args, **kwargs)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/web/frontend/group_plugin_action.py", line 25, in handle
response = plugin.get_view_response(request, group)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/plugin.py", line 113, in get_view_response
return super(YouTrackPlugin, self).get_view_response(request, group)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/plugins/base/v1.py", line 296, in get_view_response
response = self.view(request, group)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/plugin.py", line 131, in view
return view(request, group, **kwargs)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/plugins/bases/issue.py", line 169, in view
form = self.get_new_issue_form(request, group, event)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/plugin.py", line 77, in get_new_issue_form
project_fields=self.get_project_fields(group.project),
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/plugin.py", line 57, in get_project_fields
return cached_fields(self.get_option('ignore_fields', project))
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/utils.py", line 16, in wrapper
cache.set(key, result, timeout)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/core/cache/backends/memcached.py", line 82, in set
self._cache.set(key, value, self._get_memcache_timeout(timeout))
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 740, in set
return self._set("set", key, val, time, min_compress_len, noreply)
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 1060, in _set
return _unsafe_set()
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 1034, in _unsafe_set
store_info = self._val_to_store_info(val, min_compress_len)
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 998, in _val_to_store_info
pickler.dump(val)
PicklingError: Can't pickle <type 'generator'>: attribute lookup __builtin__.generator failed
遵循回溯( https://github.com/bogdal/sentry-youtrack/blob/master/sentry_youtrack/utils.py#L6 ):
def cache_this(timeout=60):
def decorator(func):
def wrapper(*args, **kwargs):
def get_cache_key(*args, **kwargs):
params = list(args) + kwargs.values()
return md5("".join(map(str, params))).hexdigest()
key = get_cache_key(func.__name__, *args, **kwargs)
result = cache.get(key)
if not result:
result = func(*args, **kwargs)
cache.set(key, result, timeout)
return result
return wrapper
return decorator
据我了解,我们收到此错误是因为 result
是一个生成器。
https://github.com/bogdal/sentry-youtrack/blob/master/sentry_youtrack/plugin.py#L51 :
def get_project_fields(self, project):
@cache_this(600)
def cached_fields(ignore_fields):
yt_client = self.get_youtrack_client(project)
return yt_client.get_project_fields(
self.get_option('project', project), ignore_fields)
return cached_fields(self.get_option('ignore_fields', project))
https://github.com/bogdal/sentry-youtrack/blob/master/sentry_youtrack/youtrack.py#L198 :
def get_project_fields(self, project_id, ignore_fields=None):
ignore_fields = ignore_fields or []
for field in self.get_project_fields_list(project_id):
if not field['name'] in ignore_fields:
yield self._get_custom_project_field_details(field)
所以,我正在尝试将其转换为列表:
if not result:
result = func(*args, **kwargs)
cache.set(key, [f for f in result], timeout)
return result
但仍然遇到同样的错误:
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/utils.py", line 16, in wrapper
cache.set(key, [f for f in result], timeout)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/core/cache/backends/memcached.py", line 82, in set
self._cache.set(key, value, self._get_memcache_timeout(timeout))
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 740, in set
return self._set("set", key, val, time, min_compress_len, noreply)
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 1060, in _set
return _unsafe_set()
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 1034, in _unsafe_set
store_info = self._val_to_store_info(val, min_compress_len)
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 998, in _val_to_store_info
pickler.dump(val)
PicklingError: Can't pickle <type 'generator'>: attribute lookup __builtin__.generator failed
然后我尝试记录 val
的值进入文件:
try:
pickler.dump(val)
except Exception:
with open('/tmp/quanta.log', 'a+') as f:
f.write(str(val))
但该文件未创建。奇怪的是回溯说错误发生在与之前相同的行:
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../sentry_youtrack/utils.py", line 16, in wrapper
cache.set(key, [f for f in result], timeout)
File "/usr/local/sentry/local/lib/python2.7/site-packages/sentry/../django/core/cache/backends/memcached.py", line 82, in set
self._cache.set(key, value, self._get_memcache_timeout(timeout))
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 740, in set
return self._set("set", key, val, time, min_compress_len, noreply)
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 1060, in _set
msg = msg[1]
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 1034, in _unsafe_set
File "/usr/local/sentry/local/lib/python2.7/site-packages/memcache.py", line 998, in _val_to_store_info
try:
PicklingError: Can't pickle <type 'generator'>: attribute lookup __builtin__.generator failed
所以,我有两个问题:
Can't pickle <type 'generator'>...
当它已转换为列表时?val
的值在调用pickler.dump(val)
之前?最佳答案
这是sentry-youtrack 的一个错误,它不应该缓存生成器对象。 python-memcached 可能有一个 pyc 文件,这就是为什么它没有像您修改的那样转储值。并且您添加了(i for i in list),它也是一个生成器。
您应该使用 getsentry/sentry-youtrack 因为它有 correct fix用于缓存生成器。
关于python - Sentry-youtrack 插件 : PicklingError: Can't pickle <type 'generator' >: attribute lookup __builtin__. 生成器失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39650623/
我在cmd中发起了焰火,并在下面进行了表演,以提高我的技能。。当我执行a.take(1)时,我得到“_ickle.PicklingError:无法序列化对象:IndexError:tuple inde
我有以下两个数据帧:df_whitelist和df_text +-------+--------------------+ |keyword| whitelist_terms | +------
执行示例 from multiprocessing import Process def f(name): print 'hello', name if __name__ == '__main
我正在做一个 Python/Django/Wagtail 项目,我有一些 api 可以返回一些分页的文章。它是这样的: 在网址中: url(r'^morearticles/', views.get_l
在多处理模块中使用 Pool.map_async()(以及 Pool.map())时遇到问题。我已经实现了一个并行循环函数,只要 Pool.map_async 的函数输入是“常规”函数,它就可以正常工
我在测试使用 mock 调用方法时遇到问题-- 作为一个简单的例子,假设方法是 os.getcwd .我想测试我自己的功能,pickle_wdir , 正在调用 os.getcwd如预期。但是,我正在
你知道解决这个问题的方法吗: [Thu Jul 08 19:15:38 2010] [error] [client 79.162.31.162] mod_wsgi (pid=3072): Except
下面的最小示例使用了一个虚拟装饰器,它只是在构造装饰类的对象时打印一些消息。 import pickle def decorate(message): def call_decorator(f
我有以下代码: def decorator(func): @functools.wraps(func) def other_func(): print('other f
尝试围绕执行 map_async() 的函数编写一些单元测试手术。更具体地说,我想确认在某个进程中发生异常时某些文件会被清理。下面提供了具有意图的示例伪代码。 foo.py def write_chu
我正在尝试编写一个基于 multiprocessing 的便捷函数库,它接受任何函数和参数,并使用多个进程运行该函数。我正在导入以下文件“MultiProcFunctions.py”: import
在没有修改的情况下运行 Elephas 示例时出错:(即使使用 git 版本 pip install --no-cache-dir git+git://github.com/maxpumperla/e
我正在尝试根据本教程的指导为 Python sklearn 管道创建自定义转换器:http://danielhnyk.cz/creating-your-own-estimator-scikit-lea
我想在给定目录中的所有图像中搜索冲浪,并保存它们的关键点和描述符以供将来使用。我决定使用pickle,如下所示: #!/usr/bin/env python import os import pick
很抱歉,我无法用更简单的示例重现该错误,并且我的代码太复杂而无法发布。如果我在 IPython shell 而不是常规的 Python 中运行程序,一切都会顺利进行。 我查阅了有关此问题的一些以前的注
我在 dataproc 上运行 pyspark 作业时遇到此错误。可能是什么原因 ? 这是错误的堆栈跟踪。 File "/usr/lib/python2.7/pickle.py", line 33
我希望使用 Celery/RabbitMQ 在 Windows 7 和 Python 3.3 上的 Flask 应用程序中运行常规间隔任务。 Pip 安装: billiard==3.3.0.10 ce
这个问题在这里已经有了答案: Can't pickle when using multiprocessing Pool.map() (14 个答案) 关闭 5 年前。 我正在尝试使用 python
当我尝试使用以下命令将表复制到 cassandra 时: copy images from 'images.csv' 我得到错误: 'PicklingError: Can't pickle : att
我从我的 GAE Python 应用程序中的这行代码中收到 PicklingError: deferred.defer(email_voters_begin, ekey, voter_list) 这三
我是一名优秀的程序员,十分优秀!