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

Token object has no attribute data #3

Open
ambroisie opened this issue Apr 10, 2022 · 1 comment
Open

Token object has no attribute data #3

ambroisie opened this issue Apr 10, 2022 · 1 comment

Comments

@ambroisie
Copy link

Wrongfully reported as LaunchPlatform/beancount-parser#6.

I get the following traceback on my ledger:

Traceback (most recent call last):
  File "/nix/store/lzm05hhhr0ai8zg3d2a0m221rjl8fdsp-python3.9-beancount-black-0.1.9/bin/.bean-black-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/p3gl9nwd2m0f9sixss1nw5q2pdzmvn6h-python3.8-click-7.1.2/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/p3gl9nwd2m0f9sixss1nw5q2pdzmvn6h-python3.8-click-7.1.2/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/nix/store/p3gl9nwd2m0f9sixss1nw5q2pdzmvn6h-python3.8-click-7.1.2/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/p3gl9nwd2m0f9sixss1nw5q2pdzmvn6h-python3.8-click-7.1.2/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/nix/store/lzm05hhhr0ai8zg3d2a0m221rjl8fdsp-python3.9-beancount-black-0.1.9/lib/python3.9/site-packages/beancount_black/main.py", line 49, in main
    formatter.format(tree, output_file)
  File "/nix/store/lzm05hhhr0ai8zg3d2a0m221rjl8fdsp-python3.9-beancount-black-0.1.9/lib/python3.9/site-packages/beancount_black/formatter.py", line 573, in format
    sections.append(self.format_statement_group(group))
  File "/nix/store/lzm05hhhr0ai8zg3d2a0m221rjl8fdsp-python3.9-beancount-black-0.1.9/lib/python3.9/site-packages/beancount_black/formatter.py", line 521, in format_statement_group
    remain_entries.sort(key=self.get_entry_sorting_key)
  File "/nix/store/lzm05hhhr0ai8zg3d2a0m221rjl8fdsp-python3.9-beancount-black-0.1.9/lib/python3.9/site-packages/beancount_black/formatter.py", line 187, in get_entry_sorting_key
    if first_child.data == "date_directive":
AttributeError: 'Token' object has no attribute 'data'

I have not yet tried to minimise the ledger to find the problem.

@fangpenlin
Copy link
Contributor

Can you please provide a sample beancount file for reproducing this error? Also, I just fixed many of the bugs and upgraded the beancount parser to latest one. There are many bugs has been fixed in between. Can you please try again and see if the problem is now gone?

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