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

LuigiTomlParser object has no attribute 'sections' #3182

Closed
mzpqnxow opened this issue Jul 11, 2022 · 0 comments
Closed

LuigiTomlParser object has no attribute 'sections' #3182

mzpqnxow opened this issue Jul 11, 2022 · 0 comments

Comments

@mzpqnxow
Copy link
Contributor

Missing/incorrect method when loading TOML configuration data

When loading a TOML configuration file on Luigi==3.1.0, I get the following backtrace:

Traceback (most recent call last):
  File "/home/user/luigi-test-proj/venv/bin/luigi", line 8, in <module>
    sys.exit(luigi_run())
  File "/home/user/luigi-test-proj/venv/lib/python3.9/site-packages/luigi/cmdline.py", line 9, in luigi_run
    run_with_retcodes(argv)
  File "/home/user/luigi-test-proj/venv/lib/python3.9/site-packages/luigi/retcodes.py", line 71, in run_with_retcodes
    retcodes = retcode()
  File "/home/user/luigi-test-proj/venv/lib/python3.9/site-packages/luigi/task_register.py", line 87, in __call__
    param_values = cls.get_param_values(params, args, kwargs)
  File "/home/user/luigi-test-proj/venv/lib/python3.9/site-packages/luigi/task.py", line 439, in get_param_values
    if task_family in conf.sections():
AttributeError: 'LuigiTomlParser' object has no attribute 'sections'

When I take a look at the LuigiTomlParser, it's pretty easy to see a way to fix this with minimal effort, by adding a sections() method that just returns a simple list of the sections-

+    def sections(self):
+        """Return a list of sections as list of strings"""
+        return [section for section in self.data.keys() if section.lower() != 'logging']
+

I will attach my configuration file, though it's worth mentioning the example toml from this repo also causes the issue

mzpqnxow added a commit to mzpqnxow/luigi that referenced this issue Jul 11, 2022
mzpqnxow added a commit to mzpqnxow/luigi that referenced this issue Jul 11, 2022
dlstadther added a commit that referenced this issue Jul 15, 2022
…3185)

Co-authored-by: Dillon Stadther <dlstadther@gmail.com>
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

No branches or pull requests

2 participants