question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Latest pyyaml expecting class but getting function

See original GitHub issue

Hi, I am not sure if the issue is with you or pyyaml but I just completed a clean build and get the following error when running infer_simple.py example with pyyaml version 5.1

yaml.constructor.ConstructorError: while constructing a Python instance expected a class, but found <class 'builtin_function_or_method'> in "<unicode string>", line 3, column 20: BBOX_XFORM_CLIP: !!python/object/apply:numpy.core ...

I rolled the version back to 4.2 and it works fine: pip install pyyaml==4.2b2

System information

  • Operating system: 18.04
  • Compiler version: 3.6
  • CUDA version: 10
  • cuDNN version: 9
  • NVIDIA driver version: 415
  • GPU models (for all devices if they are not all the same): 1080ti
  • PYTHONPATH environment variable: NA
  • python --version output: 3.6.7
  • Anything else that seems relevant: ?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:30
  • Comments:7

github_iconTop GitHub Comments

64reactions
matthhancommented, Mar 31, 2019

I encountered the same error and solved the problem by changing yaml_load = yaml.load to yaml_load = lambda x: yaml.load(x, Loader=yaml.Loader) in detectron/utils/env.py Not sure if this is a valid solution in every case, because yaml.load might be used elsewhere in the codebase. However, in my case this was a good workaround.

3reactions
haoranshcommented, Apr 20, 2019

Another workaround is to roll back the pyyaml to 3.12 version, since the detectron seems built on that version initially. A similar problem is in https://github.com/facebookresearch/DensePose/issues/216

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Pyyaml: Default dump behavior for inherited classes
As you can see I already tried assigning the class a default tag, but that did not quite work out. Defining a custom...
Read more >
Latest pyyaml expecting class but getting function #840(配置 ...
Hi,I am not sure if the issue is with you or pyyaml but I just completed a clean build and get the following...
Read more >
YAML: The Missing Battery in Python
PyYAML can make this confusing due to the plethora of functions and classes to choose from. Plus, the library's documentation doesn't reliably ...
Read more >
YAML Deserialization Attack in Python - Net Square
Let's try to execute the last code in PyYAML version < 5.1 and the output will ... __reduce__() class method and this get...
Read more >
Dealing with YAML with arbitrary tags in Python
in which we use PyYAML to safely read and write YAML with any tags, in a way ... imagine getting a Dice from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found