orgparse icon indicating copy to clipboard operation
orgparse copied to clipboard

Providing OrgEnv to load() with pathlib.Path errors

Open hrehfeld opened this issue 3 years ago • 1 comments

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 avatar Aug 02 '22 13:08 hrehfeld

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.

anoduck avatar Oct 31 '22 09:10 anoduck