kannibalox / pyrosimple

An overhauled fork of the pyrocore tools for rTorrent
https://kannibalox.github.io/pyrosimple/
GNU General Public License v3.0
48 stars 5 forks source link

pyroadmin can only create default config when directory exists #30

Closed JohnFlowerful closed 1 year ago

JohnFlowerful commented 1 year ago

Executing pyroadmin --verbose config --create-config when the path doesn't exist exits with:

INFO:pyrosimple.scripts.pyroadmin.AdminTool:Creating pyrosimple config file '/home/flower/.config/pyrosimple/config.toml'
INFO:pyrosimple.scripts.pyroadmin.AdminTool:Total time: 0.009 seconds.
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.10/pyroadmin", line 8, in <module>
    sys.exit(run())
  File "/usr/lib/python3.10/site-packages/pyrosimple/scripts/pyroadmin.py", line 303, in run
    AdminTool().run()
  File "/usr/lib/python3.10/site-packages/pyrosimple/scripts/base.py", line 173, in run
    self.mainloop()
  File "/usr/lib/python3.10/site-packages/pyrosimple/scripts/pyroadmin.py", line 298, in mainloop
    self.args.func()
  File "/usr/lib/python3.10/site-packages/pyrosimple/scripts/pyroadmin.py", line 273, in config
    self.create_config()
  File "/usr/lib/python3.10/site-packages/pyrosimple/scripts/pyroadmin.py", line 248, in create_config
    with config_path.open("wb") as fh:
  File "/usr/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/home/flower/.config/pyrosimple/config.toml'

Is this expected behaviour or should --create-config check if ~/.config/pyrosimple exists?

kannibalox commented 1 year ago

Thanks for the heads up, the intention was to have it create the directories if they didn't exist. That probably changed when I refactored the configuration away from dynaconf.