Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: load config using yaml.safe_load(), not yaml.load() (#202)
Browse files Browse the repository at this point in the history
Attempt to address exception:

    Traceback (most recent call last):
      File "/edx/app/ecomworker/venvs/ecomworker/bin/celery", line 8, in <module>
        sys.exit(main())
      File "/edx/app/ecomworker/venvs/ecomworker/lib/python3.8/site-packages/celery/__main__.py", line 16, in main
        _main()
      File "/edx/app/ecomworker/venvs/ecomworker/lib/python3.8/site-packages/celery/bin/celery.py", line 322, in main
        cmd.execute_from_commandline(argv)
      File "/edx/app/ecomworker/venvs/ecomworker/lib/python3.8/site-packages/celery/bin/celery.py", line 499, in execute_from_commandline
        super(CeleryCommand, self).execute_from_commandline(argv)))
      File "/edx/app/ecomworker/venvs/ecomworker/lib/python3.8/site-packages/celery/bin/base.py", line 305, in execute_from_commandline
        return self.handle_argv(self.prog_name, argv[1:])
    [...]
      File "/edx/app/ecomworker/venvs/ecomworker/lib/python3.8/site-packages/celery/app/base.py", line 920, in _finalize_pending_conf
        conf = self._conf = self._load_config()
      File "/edx/app/ecomworker/venvs/ecomworker/lib/python3.8/site-packages/celery/app/base.py", line 930, in _load_config
        self.loader.config_from_object(self._config_source)
    [...]
      File "/edx/app/ecomworker/ecomworker/ecommerce_worker/configuration/production.py", line 18, in <module>
        config_from_yaml = yaml.load(f)
    TypeError: load() missing 1 required positional argument: 'Loader'

Docs: https://pyyaml.org/wiki/PyYAMLDocumentation#loading-yaml
  • Loading branch information
pshiu authored Jun 15, 2023
1 parent 3c37f1e commit 6f3a3b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ecommerce_worker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""init"""

__version__ = '3.3.3'
__version__ = '3.3.4'
2 changes: 1 addition & 1 deletion ecommerce_worker/configuration/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

filename = get_overrides_filename('ECOMMERCE_WORKER_CFG')
with open(filename) as f:
config_from_yaml = yaml.load(f)
config_from_yaml = yaml.safe_load(f)

# Override base configuration with values from disk.
vars().update(config_from_yaml)

0 comments on commit 6f3a3b7

Please sign in to comment.