[Bug] tilde ~ in override value will not work
See original GitHub issue🐛 Bug
Description
tilde (~) at the beginning of the value results in hydra.errors.OverrideParseException
Checklist
- I checked on the latest version of Hydra
- I created a minimal repro (See this for tips).
To reproduce
** Minimal Code/Config snippet to reproduce **
python main.py hydra.run.dir=~/outputs
** Stack trace/error message **
LexerNoViableAltException: hydra.run.dir=~/outputs
^
See https://hydra.cc/docs/next/advanced/override_grammar/basic for details
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Expected Behavior
work without error.
System information
- Hydra Version : 1.0.6
- Python version : 3.6
- Virtual environment type and version : pyenv 1.2.21
- Operating system : linux ubuntu 16.04.3 LTS
Additional context
None.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Tilde Slash Paths Not Working in MVC 4 - Stack Overflow
The workaround is to use Razor comments instead of HTML comments. I.e., replace <!-- Here's your comment--> with @* Here's your comment *@...
Read more >How to replace tilde and wildcard characters in Excel?
1. Select the range where you will replace the tilde or wildcard characters, and press Ctrl + H keys to open the Find...
Read more >Removing tilde from attribute table - GIS Stack Exchange
I am trying to remove the tilde from a few fields in my ArcGIS Pro attribute tables. I was given a few .txt...
Read more >How to escape the tilde '~' and other special characters in ...
The following lists the Progress special characters that are escaped using the tilde including the tilde itself. All the items listed below ...
Read more >Tilde (~) not recognized by Excel? | MrExcel Message Board
when i use VLOOKUP to look up what is in Col B for 'sky~net', i get an '#N/A' error. Looks like the tilde...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you are expecting hydra.run.dir=~/outputs to expand to your home directory, this is a function of the shell. You can try to echo it and see if your shell does it or not:
As you can see, my shell (bash) is not expanding ~ in the middle of a string. This has nothing to do with Hydra.
The reason you are getting an error from Hydra is that ~ is a special character for Hydra as well and it can’t appear in an unquoted string. Since both Hydra and your shell will intercept quotes, you need to quote twice:
However, because ~ is not expanded by the shell the output directory created will actually contain the
~
character.Alright. I used value interpolation as a cumbersome workaround.