altf4/libmelee

Obscure error when calling setup_dolphin_controller with no path

Noah-C-S opened this issue · 1 comments

When you call setup_dolphin_controller without supplying a path to the console constructor, you get a really annoying and obscure config parser error that doesn't do a good job of telling the user what the issue is. Notably, this happens when someone tries to run example.py without passing in an executable path.

The error is something like :

Python\Python39\lib\configparser.py", line 902, in set raise NoSectionError(section) from None configparser.NoSectionError: No section: 'Core'

Additionally, the program creates a file called "GCPadNew.ini" wherever the program is running if no path is supplied... this is pretty annoying. Should verify that the Dolphin path is valid before doing creating the file. One way could be to try and write to Dolphin.ini, which throws an exception when the path is invalid, before creating GCPadNew.ini.

If you just skip the function if no path is supplied, then it works fine as long as the configs are already setup (i.e. it's not the first time the user has run the program), but the program-supplied controls don't work if the configs aren't set up.

Should either replace this with a more descriptive exception or a warning. More generally, this project might benefit from a type of exception that is thrown when someone makes a mistake when using the library, like a "melee.meleeException" or something so that you can throw more descriptive errors (if you don't already have one; never spotted any exceptions like this).

altf4 commented

Added an exception for that case in db8eb32

That particular error message was not obvious.