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

[Bug] LexerNoViableAltException: word.p=a|b (error comes from the vertical bar) #1843

Closed
zhaoyanpeng opened this issue Oct 4, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@zhaoyanpeng
Copy link

hi there,

looks hydra does not support escaping a vertical bar? I checked the doc and it says

... by escaping them with a \. These characters are: \()[]{}:=, \t (the last two ones being the whitespace and tab characters).

any reason for not escaping vertical bar? one of my running parameters is a regex expression, which contains a vertical bar, but I cannot send it in from the command line, e.g, python main.py word.p=a\|b

@zhaoyanpeng zhaoyanpeng added the bug Something isn't working label Oct 4, 2021
@Jasha10
Copy link
Collaborator

Jasha10 commented Oct 4, 2021

I can reproduce the issue:

$ cd ~/hydra.git/examples/tutorials/basic/your_first_hydra_app/1_simple_cli/
$ python my_app.py '+foo=ab'
foo: ab

$ # with unescaped bar:
$ python my_app.py '+foo=a|b'
LexerNoViableAltException: +foo=a|b
                                 ^
...

$ # with escaped bar:
$ python my_app.py '+foo=a\|b'
LexerNoViableAltException: +foo=a\|b
                                  ^
...

@jieru-hu
Copy link
Contributor

jieru-hu commented Oct 4, 2021

the following works for me:

$ python examples/tutorials/basic/your_first_hydra_app/2_config_file/my_app.py '+foo="a|b"'
db:
  driver: mysql
  user: omry
  password: secret
foo: a|b

@zhaoyanpeng
Copy link
Author

thanks @jieru-hu , that works! quoting only the right-hand-side also works: python main.py word.p='"a|b"'

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

3 participants