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

improve exit on bad config file #56

Open
txoof opened this issue Nov 19, 2022 · 2 comments
Open

improve exit on bad config file #56

txoof opened this issue Nov 19, 2022 · 2 comments
Labels
enhancement New feature or request Work To Do Work that needs to be done

Comments

@txoof
Copy link
Owner

txoof commented Nov 19, 2022

12:38:13 paperpi :get_config_files:251 :INFO       - using configuration files to configure PaperPi: [PosixPath('/home/pi/src/PaperPi/paperpi/config/paperpi.ini'), PosixPath('/home/pi/.config/com.txoof.paperpi/paperpi.ini')]
Traceback (most recent call last):
  File "/home/pi/src/PaperPi/paperpi/./paperpi.py", line 758, in <module>
    exit_code = main()
  File "/home/pi/src/PaperPi/paperpi/./paperpi.py", line 644, in main
    config_files = get_config_files(cmd_args)
  File "/home/pi/src/PaperPi/paperpi/./paperpi.py", line 254, in get_config_files
    config_files.parse_config()
  File "/home/pi/.local/share/virtualenvs/PaperPi-VBShxqF-/lib/python3.9/site-packages/ArgConfigParse/ArgConfigParse.py", line 227, in parse_config
    self.parser.read(file)
  File "/usr/lib/python3.9/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/usr/lib/python3.9/configparser.py", line 1113, in _read
    raise e
configparser.ParsingError: Source contains parsing errors: PosixPath('/home/pi/.config/com.txoof.paperpi/paperpi.ini')
	[line 195]: "'''\n"

It would be good to exit with a better error message and try to identify the problem in the config file rather than just crashing out.

@txoof txoof added the enhancement New feature or request label Nov 19, 2022
@txoof
Copy link
Owner Author

txoof commented Dec 10, 2022

additional example:

$ sudo /usr/local/bin/paperpi -d
12:50:24 paperpi :get_config_files:251 :INFO       - using configuration files to configure PaperPi: [PosixPath('/usr/local/paperpi/config/paperpi.ini'), PosixPath('/etc/default/paperpi.ini')]
Traceback (most recent call last):
  File "/usr/local/paperpi/paperpi.py", line 759, in <module>
    exit_code = main()
  File "/usr/local/paperpi/paperpi.py", line 699, in main
    screen_return = setup_display(config)
  File "/usr/local/paperpi/paperpi.py", line 485, in setup_display
    screen.clearEPD()
  File "/usr/local/paperpi/.venv/lib/python3.9/site-packages/epdlib/Screen.py", line 244, in wrapper
    raise UnboundLocalError('no epd is configured')
UnboundLocalError: no epd is configured

@txoof
Copy link
Owner Author

txoof commented Jun 23, 2023

see commit

@txoof txoof added the Work To Do Work that needs to be done label Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Work To Do Work that needs to be done
Projects
None yet
Development

No branches or pull requests

1 participant