stanfordnqp / spins-b

Photonic optimization library
GNU General Public License v3.0
289 stars 113 forks source link

TypeError: load() missing 1 required positional argument: 'Loader' #81

Open saiGo1992 opened 1 year ago

saiGo1992 commented 1 year ago

When I run monitor_processing_example, I come across error below: image could anyone tell me how to fix this error?

LumiereWuChu commented 1 year ago

The use of yaml.load(file) was deprecated after YAML 5.1 because it was felt to be insecure, and after 5.1 it was changed to require specifying a loader to disable the execution of arbitrary functions via the default loader (FullLoader), and the load function became more Safe The following three changes to monitor_spec.py:182 are all valid to resolve the error

monitor_descriptions=MonitorDescriptionList(yaml.load(fp,Loader=yaml.FullLoader)) monitor_descriptions=MonitorDescriptionList(yaml.safe_load(fp)) monitor_descriptions=MonitorDescriptionList(yaml.load(fp,Loader=yaml.CLoader))