Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io.py incompatible with PyYAML-6.0 #43

Closed
nieder opened this issue Oct 18, 2022 · 0 comments · Fixed by #50
Closed

io.py incompatible with PyYAML-6.0 #43

nieder opened this issue Oct 18, 2022 · 0 comments · Fixed by #50

Comments

@nieder
Copy link

nieder commented Oct 18, 2022

When building meza, this test failure happens:

Doctest: meza.io.read_yaml ... FAIL

======================================================================
FAIL: Doctest: meza.io.read_yaml
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python3.9/doctest.py", line 2205, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for meza.io.read_yaml
  File "/sw/build.build/meza-py39-0.46.0-1/meza-0.46.0/meza/io.py", line 1256, in read_yaml

----------------------------------------------------------------------
File "/sw/build.build/meza-py39-0.46.0-1/meza-0.46.0/meza/io.py", line 1279, in meza.io.read_yaml
Failed example:
    next(records) == {
        'text': 'Chicago Reader',
        'float': 1.0,
        'datetime': dt(1971, 1, 1, 4, 14),
        'boolean': True,
        'time': '04:14:00',
        'date': date(1971, 1, 1),
        'integer': 40}
Exception raised:
    Traceback (most recent call last):
      File "/sw/lib/python3.9/doctest.py", line 1334, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest meza.io.read_yaml[3]>", line 1, in <module>
        next(records) == {
      File "/sw/build.build/meza-py39-0.46.0-1/meza-0.46.0/meza/io.py", line 551, in read_any
        for line in _read_any(f, reader, args, **kwargs):
      File "/sw/build.build/meza-py39-0.46.0-1/meza-0.46.0/meza/io.py", line 470, in _read_any
        for num, line in enumerate(reader(f, *args, **kwargs)):
    TypeError: load() missing 1 required positional argument: 'Loader'

In

meza/meza/io.py

Line 1289 in 370c292

return read_any(filepath, yaml.load, mode, **kwargs)
, changing yaml.load to yaml.safe_load takes care of the problem (not sure what version yaml.safe_load was introduced).
See yaml/pyyaml#576

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant