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

AttributeError in _iter_lines: 'str' object has no attribute 'search' #29

Open
gioccher opened this issue Nov 25, 2024 · 2 comments
Open

Comments

@gioccher
Copy link

Hi, I stumbled on this regression after upgrading from 2.0.4 to 2.1.1 and calling format_exc() in an except: block

  File "/opt/nautobot/jobs/nautobot_ssot_xxx.py", line 1380, in sync_data
    self.logger.debug("```\n%s\n```", format_exc())
  File "/opt/nautobot/.local/lib/python3.9/site-packages/traceback_with_variables/core.py", line 102, in format_exc
    return '\n'.join(iter_exc_lines(
  File "/opt/nautobot/.local/lib/python3.9/site-packages/traceback_with_variables/core.py", line 177, in _iter_lines
    if bool(fmt_.skip_files_except) and all(not p.search(filename) for p in fmt_.skip_files_except):
  File "/opt/nautobot/.local/lib/python3.9/site-packages/traceback_with_variables/core.py", line 177, in <genexpr>
    if bool(fmt_.skip_files_except) and all(not p.search(filename) for p in fmt_.skip_files_except):
AttributeError: 'str' object has no attribute 'search'

the exception raised was of type pydantic_core._pydantic_core.ValidationError

@andy-landy
Copy link
Owner

andy-landy commented Dec 3, 2024

Hi, I can't understand the reason for that, hmmm... It looks like ".skip_files_except" contains strs, but it has to contain only re.Patterns.

Could you pls provide minimal code example and how you run it? Like
def main(): return 1/0

@gioccher
Copy link
Author

gioccher commented Dec 3, 2024

I've been trying to come up with a simple example that reproduces the issue but so far I didn't have much luck.
The error shows up in a nautobot 2.3.12 plugin which uses django ~4.2.16, pydantic==2.10.3, diffsync==2.0.1 but it's a monster of a project to setup

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

No branches or pull requests

2 participants