Skip to content

Fix octopus_saving_session regex#3710

Open
Meatballs1 wants to merge 6 commits intospringfall2008:mainfrom
Meatballs1:regex_fix_octopus_saving_session
Open

Fix octopus_saving_session regex#3710
Meatballs1 wants to merge 6 commits intospringfall2008:mainfrom
Meatballs1:regex_fix_octopus_saving_session

Conversation

@Meatballs1
Copy link
Copy Markdown
Contributor

@Meatballs1 Meatballs1 commented Mar 31, 2026

Missing parenthesis causing exceptions/crashes.

2026-03-31 10:07:58.831649: Error: Exception raised missing ), unterminated subpattern at position 1
2026-03-31 10:07:58.833245: Error: Traceback (most recent call last):
  File "/config/predbat.py", line 1565, in initialize
    self.auto_config()
  File "/config/userinterface.py", line 1077, in auto_config
    matched, arg_value = self.resolve_arg_re(arg, arg_value, state_keys)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/userinterface.py", line 1049, in resolve_arg_re
    res = re.search(my_re, key)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/re/__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/re/__init__.py", line 307, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/re/_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/re/_parser.py", line 979, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/re/_parser.py", line 460, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/re/_parser.py", line 864, in _parse
    raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 1

Better fix would be to also catch the exception and print the offending line to the log.

@daviessm
Copy link
Copy Markdown
Contributor

daviessm commented Mar 31, 2026

Can you do the same fix in all the inverter yamls? They were all broken as part of #3649

This will then fixes: #3713

@Meatballs1
Copy link
Copy Markdown
Contributor Author

Thought it wouldn't be too tedious fixing them in the web interface but I was wrong :)

@daviessm
Copy link
Copy Markdown
Contributor

Thought it wouldn't be too tedious fixing them in the web interface but I was wrong :)

Thanks! I started doing the same then pulled up the IDE and then saw your PR as I was about to start 😄

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

Successfully merging this pull request may close these issues.

2 participants