Skip to content

Commit

Permalink
Fix "play build-module" by replacing yaml.load with yaml.safe_load
Browse files Browse the repository at this point in the history
This fixes an error when "play build-module" is run on Python 3.7.11:
  load() missing 1 required positional argument: 'Loader'

This follows the recommendation shown on
  https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation

A loader argument is now required.  This commit assumes that
dependencies.yml uses standard YAML tags, and so uses safe_loader.
This is the most secure loader.
  • Loading branch information
David Costanzo committed Mar 2, 2024
1 parent b80ed47 commit f21a039
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/pym/play/commands/modulesrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def build(app, args, env):
if os.path.exists(deps_file):
f = open(deps_file)
try:
deps = yaml.load(f.read())
deps = yaml.safe_load(f.read())
if 'self' in deps:
splitted = deps["self"].split(" -> ")
if len(splitted) == 2:
Expand All @@ -354,7 +354,7 @@ def build(app, args, env):

if os.path.exists(deps_file):
f = open(deps_file)
deps = yaml.load(f.read())
deps = yaml.safe_load(f.read())
if 'self' in deps:
splitted = deps["self"].split(" -> ")
f.close()
Expand Down

0 comments on commit f21a039

Please sign in to comment.