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

Providing OrgEnv to load() with pathlib.Path errors #58

Open
hrehfeld opened this issue Aug 2, 2022 · 1 comment
Open

Providing OrgEnv to load() with pathlib.Path errors #58

hrehfeld opened this issue Aug 2, 2022 · 1 comment

Comments

@hrehfeld
Copy link

hrehfeld commented Aug 2, 2022

from pathlib import Path
fp = Path('mypath')
env = orgparse.OrgEnv(filename=fp)
root = orgparse.load(fp, env)

=>

  File "/usr/lib/python3.10/site-packages/orgparse/__init__.py", line 142, in load
    return loadi(lines, filename=filename, env=env)
  File "/usr/lib/python3.10/site-packages/orgparse/__init__.py", line 162, in loadi
    return parse_lines(lines, filename=filename, env=env)
  File "/usr/lib/python3.10/site-packages/orgparse/node.py", line 1447, in parse_lines
    raise ValueError('If env is specified, filename must match')

Just converting path to str during env creation workarounds:

from pathlib import Path
fp = Path('mypath')
env = orgparse.OrgEnv(filename=str(fp))
root = orgparse.load(fp, env)
@hrehfeld hrehfeld changed the title Providing OrgEnv to load() with Paths gives error Providing OrgEnv to load() with pathlib.Path errors Aug 2, 2022
@anoduck
Copy link

anoduck commented Oct 31, 2022

Saw the issue, and wanted to provide some assistance, in the spirit of paying it forward... But, unsure what the issue is, or even if there is one.

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

2 participants