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

save & load config fail in combination with sidecar-template #1716

Open
Syntaxheld opened this issue Oct 14, 2024 · 6 comments
Open

save & load config fail in combination with sidecar-template #1716

Syntaxheld opened this issue Oct 14, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Syntaxheld
Copy link

Syntaxheld commented Oct 14, 2024

Describe the bug
When using the --sidecar-template option and saving the command to a TOML config file, osxphotos crashes when loading that config file.

To Reproduce
Steps to reproduce the behavior:

  1. osxphotos export --directory "{created}{moment?{comma} {moment},}" --album export-test --sidecar-template custom_sidecar_json.mako "{filepath}.json" write_skipped,strip_lines --edited-suffix "-edit" --save-config CONFIG.toml --config-only DIR
  2. osxphotos export --load-config CONFIG.toml DIR
  3. Something went wrong and osxphotos encountered an error: list index out of range

Expected behavior
Export command using the config file should work just as well as the one without.

Desktop (please complete the following information):

  • OS: macOS Sequoia Beta 15.1 (24B5070a)
  • osxphotos version: osxphotos, version 0.68.6
    Python 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 16.0.0 (clang-1600.0.26.3)]
    macOS 15.1.0, arm64

Additional context
If you comment out the sidecar_template line in the toml file (and specify the option on the CLI), it works.

Crashlog attached.
osxphotos_crash.log

@Syntaxheld
Copy link
Author

and the generated config file from the first reproduction step:
CONFIG.toml.zip

@RhetTbull RhetTbull added the bug Something isn't working label Oct 14, 2024
@RhetTbull
Copy link
Owner

Weird...I'm using the same TOML library to write the config file as I am to read it. I'll take a look to see if I can figure out what is going on.

@Syntaxheld
Copy link
Author

I have run the file through https://www.toml-lint.com/ ... and it says it's valid. 🤷🏻
So maybe it is an issue in combination with the option parsing?

@RhetTbull
Copy link
Owner

This appears to be a known bug in the toml library used by OSXPhotos. I've confirmed that both tomli and the built in tomllib (which is only available in python 3.11+) do not have this problem and correctly parse the toml file.

I will update the toml code in OSXPhotos to use tomli. In the next release I'll be dropping support for Python 3.9 and adding support for Python 3.13. Once I get to Python 3.11 as the minimum I can then use the built in toml library.

In the meantime you can pass the --sidecar-template option directly on the command line instead of via the config file.

@RhetTbull
Copy link
Owner

@all-contributors please add @Syntaxheld for bug

Copy link
Contributor

@RhetTbull

I've put up a pull request to add @Syntaxheld! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants