orgparse
orgparse copied to clipboard
Providing OrgEnv to load() with pathlib.Path errors
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)
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.