PyYAML错误:TypeError:无法挑选_thread.RLock对象

时间:2018-03-09 20:14:26

标签: python-3.x pyyaml

我试图使用YAML转储可能有点复杂的类,并且看到以下错误。我不知道pickle做了什么,但据我所知,我没有参与任何多线程编程。运行pyunit单元测试时会发生这种情况:

知道如何找到有问题的属性吗?

 ERROR: test_multi_level_needs (test_needs.needs_TestCase)
 -----------------------------------------------------------
 Traceback (most recent call last):
   File "/Users/rsalemi/.../test_needs.py", line 240, in test_multi_level_needs
     print(yaml.dump(test2_comp))
   File ".../.../yaml/__init__.py", line 200, in dump        

  <snipped lots of stack trace>


    File ".../.../yaml/representer.py", line 91, in represent_sequence
      node_item = self.represent_data(item)
    File ".../.../yaml/representer.py", line 51, in represent_data
      node = self.yaml_multi_representers[data_type](self, data)
    File ".../.../yaml/representer.py", line 341, in represent_object
      'tag:yaml.org,2002:python/object:'+function_name, state)
    File ".../.../yaml/representer.py", line 116, in represent_mapping
      node_value = self.represent_data(item_value)
    File ".../.../yaml/representer.py", line 51, in represent_data
      node = self.yaml_multi_representers[data_type](self, data)
    File ".../.../yaml/representer.py", line 315, in represent_object
      reduce = data.__reduce_ex__(2)
  TypeError: can't pickle _thread.RLock objects

0 个答案:

没有答案