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

TypeError: unsupported operand type(s) for |: 'dict' and 'str' #511

Open
esnible opened this issue Feb 24, 2025 · 1 comment
Open

TypeError: unsupported operand type(s) for |: 'dict' and 'str' #511

esnible opened this issue Feb 24, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@esnible
Copy link
Member

esnible commented Feb 24, 2025

Describe the bug
The following PDL program produces a backtrace and the output TypeError: unsupported operand type(s) for |: 'dict' and 'str'

To Reproduce
Use this program:

object:
  - defs:
      CONCLUSIONS:
        for:
          v: ["a", "b", "c"]
        repeat:
          data:
            ${ v }: ${ v }

Expected behavior
Either {"a": "a", "b": "b", "c": "c"} or a meaningful error message.

Desktop (please complete the following information):

  • Version PDL 0.3.1.dev110+ga736767.d20250224
@esnible esnible added the bug Something isn't working label Feb 24, 2025
@esnible
Copy link
Member Author

esnible commented Feb 24, 2025

Note: I originally wanted to use join: instead of object:, like this:

for:
  i: [1, 2]
repeat:
  data:
     ${ i }: ${ i }
join:
  as: object # "object" is invalid here

However, the as only allows arrays or strings or "lastOf"; there is no no dict key-value merge type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant