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 to accept PosixPath plz? #781

Closed
frankrolf opened this issue Nov 19, 2024 · 9 comments
Closed

.save to accept PosixPath plz? #781

frankrolf opened this issue Nov 19, 2024 · 9 comments

Comments

@frankrolf
Copy link
Collaborator

I really love pathLib – which allows a notation like this:

project_dir = Path('/Users/fg/my_favorite_font/')
ufos = project_dir.rglob('*.ufo')
# blah blah blah
target.save(project_dir / 'font.ufo')

Unfortunately, fontParts does not expect a PosixPath:

  File "<untitled>", line 59, in <module>
  File "lib/fontObjects/fontPartsWrappers.pyc", line 1735, in save
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.12/fontParts/base/font.py", line 203, in save
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.12/fontParts/base/normalizers.py", line 961, in normalizeFilePath
TypeError: File paths must be strings, not PosixPath.

It would be amazing if this were possible :-)

@benkiel
Copy link
Member

benkiel commented Nov 20, 2024

PR?

@knutnergaard
Copy link
Contributor

smufolib supports this. I can update the normalizer to accommodate it.

@benkiel
Copy link
Member

benkiel commented Nov 20, 2024

That would be great!

@frankrolf
Copy link
Collaborator Author

Thank you @knutnergaard 🥳

@knutnergaard
Copy link
Contributor

@benkiel Consider it done. Do you want relative paths to resolve automatically?

@benkiel
Copy link
Member

benkiel commented Nov 20, 2024

I think that would be great if easy

@knutnergaard
Copy link
Contributor

PR is #784.

@benkiel
Copy link
Member

benkiel commented Nov 22, 2024

Closing as done in the v1 branch. Sorry @frankrolf you'll have to wait a bit for it to hit release

@benkiel benkiel closed this as completed Nov 22, 2024
@frankrolf
Copy link
Collaborator Author

No worries about that! I just figured it would be a nice addition – thanks for doing the work @knutnergaard ! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants