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

get_md_relpaths_from_dir() globbing issue #12

Closed
stepsal opened this issue Jul 26, 2022 · 4 comments
Closed

get_md_relpaths_from_dir() globbing issue #12

stepsal opened this issue Jul 26, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@stepsal
Copy link
Contributor

stepsal commented Jul 26, 2022

Hello. Thanks for this library

I have tried this with 3.9 as suggested. But I'm getting an error straight away on gather.

File "/home/steve/.pyenv/versions/obsidian-python3.9.0/lib/python3.9/site-packages/obsidiantools/md_utils.py", line 29, in get_md_relpaths_from_dir
    for p in glob(str(dir_path / '**/*.md'), recursive=True)]
TypeError: unsupported operand type(s) for /: 'str' and 'str'

I have to change the /' to a + in the line in get_md_relpaths_from_dir() to get the globbing working!

change from

return [Path(p).relative_to(dir_path)
for p in glob(str(dir_path / '**/*.md'), recursive=True)]

to

return [Path(p).relative_to(dir_path)
for p in glob(str(dir_path + '**/*.md'), recursive=True)]
@stepsal
Copy link
Contributor Author

stepsal commented Jul 26, 2022

Im on Ubuntu...

@mfarragher mfarragher added the bug Something isn't working label Jul 31, 2022
@mfarragher
Copy link
Owner

Thanks - I have added comment in the Mac issue. Will be able to dedicate some time for development in next few weeks.

@mfarragher
Copy link
Owner

@stepsal does the code in this PR work for you?: #11

Code snippet if you sub in your vault directory path:

from pathlib import Path
from glob import glob

[Path(p).relative_to(dir_path)
 for p in glob(f"{dir_path}/**/*.md", recursive=True)]

I've merged the PR in the dev branch.
If the code works then I'll close this issue.

@stepsal
Copy link
Contributor Author

stepsal commented Aug 24, 2022

that works now. thanks

@stepsal stepsal closed this as completed Aug 24, 2022
@mfarragher mfarragher self-assigned this Dec 14, 2022
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