Skip to content

Token object has no attribute data #3

Description

@ambroisie

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions