gazpachoking / trainaspower

Convert TrainAsOne training plans from pace to power, and upload them to FinalSurge for use in Stryd workouts.
21 stars 5 forks source link

0.6.0 Crashing On Execution #12

Closed zisp closed 3 years ago

zisp commented 3 years ago

trainaspower.log Hi; I just updated (and then reinstalled when I had the same error after updating) TAP 0.6.0, but it's now crashing on startup for me. (Running OSX 11.2.3, python 3.9.4, poetry 1.1.4). I've attached the log file but I don't use python (or poetry) enough o be able to figure out where the issue is. A previous version (0.5.4?) was functioning without issue.

jahofmann commented 3 years ago

Does it work when you supply the path to your config file through the command line?

If that's the case it might be enough to replace https://github.com/gazpachoking/trainaspower/blob/f9f81660832edf19df85284a54f24ee25e87df47/trainaspower/main.py#L70 with

        default=str(config_file_default_path),

Seems like PathLib treats things differently on Mac.

I don't have a Mac here to test it.

gazpachoking commented 3 years ago

I think I figured it. Found this note in argparse documents:

If the type keyword is used with the default keyword, the type converter is only applied if the default is a string.

Since we are passing a Path object as the default, it isn't being wrapped by the argparse.FileType. Should be fixable by just wrapping our default with str()

EDIT: Doh, I didn't even notice this was the same fix you suggested @jahofmann 😝

zisp commented 3 years ago

Definitely fixed it for me, cheers!