quartiq / rayopt

Python optics and lens design, raytracing
GNU Lesser General Public License v3.0
254 stars 50 forks source link

yaml deprecation warning #35

Open asebian opened 2 years ago

asebian commented 2 years ago

Hi, working through the jupyter tutorial I came across this warning.

s = ro.system_from_yaml(...)
/usr/local/lib/python3.9/dist-packages/rayopt/formats.py:89: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  dat = yaml.load(text)

It was easy to suppress it, but there might be a better way.

import yaml
yaml.warnings({'YAMLLoadWarning': False})

Thanks for sharing!

decmur commented 6 months ago

This now throws an error because yaml requires a loader to be set. I believe the safe_load can be used to do the deprecated load function