Inappropriate handling of absent config file #25

Closed
opened 2020-12-06 22:24:14 +00:00 by ZAdamMac · 3 comments
ZAdamMac commented 2020-12-06 22:24:14 +00:00 (Migrated from github.com)

Describe the bug
Tapestry does not currently correctly handle instances where it is invoked without a config file available.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to a directory with no local copy of tapestry.cfg
  2. Run tapestry without specifying a config file, ie python3 -m tapestry
  3. See output below

Expected behavior
This should simply exit after the issue is raised rather than attempting to proceed, which is what is causing the error listed below.

Log/Console Output
Where possible, add the output of the Logs or Console when the problem occurs.

patches@sevastopol:~/Downloads$ python3 -m tapestry
The indicated config file: tapestry.cfg cannot be found.
Generating a template config file in that location.
Please edit this config file appropriately and rerun the program.
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/patches/.local/lib/python3.8/site-packages/tapestry/__main__.py", line 13, in <module>
    tapestry.runtime()
  File "/home/patches/.local/lib/python3.8/site-packages/tapestry/functions.py", line 1192, in runtime
    state = parse_config(state)
  File "/home/patches/.local/lib/python3.8/site-packages/tapestry/functions.py", line 858, in parse_config
    place_config_template(ns.config_path)
  File "/home/patches/.local/lib/python3.8/site-packages/tapestry/functions.py", line 985, in place_config_template
    config.set(section, option, value)
  File "/usr/lib/python3.8/configparser.py", line 1200, in set
    self._validate_value_types(option=option, value=value)
  File "/usr/lib/python3.8/configparser.py", line 1185, in _validate_value_types
    raise TypeError("option values must be strings")
TypeError: option values must be strings

Desktop (please complete the following information):

  • OS: [e.g. iOS] Ubuntu 20.04 with Python 3.8.2
  • Browser [e.g. chrome, safari] - Irrelevant? Why is this in the template?
  • Version [e.g. 22] 2.1.0

Additional context
Add any other context about the problem here.

**Describe the bug** Tapestry does not currently correctly handle instances where it is invoked without a config file available. **To Reproduce** Steps to reproduce the behavior: 1. Navigate to a directory with no local copy of `tapestry.cfg` 2. Run tapestry without specifying a config file, ie `python3 -m tapestry` 3. See output below **Expected behavior** This should simply exit after the issue is raised rather than attempting to proceed, which is what is causing the error listed below. **Log/Console Output** Where possible, add the output of the Logs or Console when the problem occurs. ``` patches@sevastopol:~/Downloads$ python3 -m tapestry The indicated config file: tapestry.cfg cannot be found. Generating a template config file in that location. Please edit this config file appropriately and rerun the program. Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/patches/.local/lib/python3.8/site-packages/tapestry/__main__.py", line 13, in <module> tapestry.runtime() File "/home/patches/.local/lib/python3.8/site-packages/tapestry/functions.py", line 1192, in runtime state = parse_config(state) File "/home/patches/.local/lib/python3.8/site-packages/tapestry/functions.py", line 858, in parse_config place_config_template(ns.config_path) File "/home/patches/.local/lib/python3.8/site-packages/tapestry/functions.py", line 985, in place_config_template config.set(section, option, value) File "/usr/lib/python3.8/configparser.py", line 1200, in set self._validate_value_types(option=option, value=value) File "/usr/lib/python3.8/configparser.py", line 1185, in _validate_value_types raise TypeError("option values must be strings") TypeError: option values must be strings ``` **Desktop (please complete the following information):** - OS: [e.g. iOS] Ubuntu 20.04 with Python 3.8.2 - Browser [e.g. chrome, safari] - Irrelevant? Why is this in the template? - Version [e.g. 22] 2.1.0 **Additional context** Add any other context about the problem here.
ZAdamMac commented 2020-12-06 22:26:05 +00:00 (Migrated from github.com)

Upon further review it also appears that the .cfg file is also not being placed as would otherwise be expected. This is a critical bug that will prevent adoption in new users and can be limiting to (e.g.) recovering users hwho cannot access their old .cfg file.

Upon further review it also appears that the .cfg file is also _not being placed_ as would otherwise be expected. This is a critical bug that will prevent adoption in new users and can be limiting to (e.g.) recovering users hwho cannot access their old .cfg file.
ZAdamMac commented 2020-12-30 19:09:01 +00:00 (Migrated from github.com)

This is down to the structure of the "default configuration" dictionary which is used to generate this configuration file. Commit
7284540 includes the relevant code change. Bug will stay open until the 2.1.1 release.

This is down to the structure of the "default configuration" dictionary which is used to generate this configuration file. Commit 7284540 includes the relevant code change. Bug will stay open until the 2.1.1 release.
ZAdamMac commented 2020-12-30 20:51:43 +00:00 (Migrated from github.com)

2.1.1 release is complete. Issue is resolved.

2.1.1 release is complete. Issue is resolved.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zadammac/Tapestry#25
No description provided.