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

DeduplicatedLogger._log() got an unexpected keyword argument stacklevel #471

Open
sjib opened this issue Oct 24, 2024 · 5 comments
Open
Labels
bug Something isn't working

Comments

@sjib
Copy link
Contributor

sjib commented Oct 24, 2024

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Exact steps to reproduce the behavior:

  1. Go to 'INTERLIS Export'
  2. Choose SIA405 Abwasser 2020.1
  3. Start export
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Variable {val} exeeds expected lenght - creates error message with stacklevel, that is not supported

Screenshots / data
If applicable, add screenshots or data to help explain your problem.
grafik

Desktop (please complete the following information):

  • TWW version 2024.0.2
  • QGIS Version
  • OS

Additional context
Add any other context about the problem here.

@sjib sjib added the bug Something isn't working label Oct 24, 2024
@sjib
Copy link
Contributor Author

sjib commented Oct 24, 2024

Locks similar to this stacklevel error we had before: #172 and that was fixed

    def truncate(self, val, max_length):
        """
        Raises a warning if values gets truncated
        """
        if val is None:
            return None
        if len(val) > max_length:
            logger.warning(f"Value '{val}' exceeds expected length ({max_length})", stacklevel=2)
        return val[0:max_length]

@sjib
Copy link
Contributor Author

sjib commented Oct 24, 2024

Or is it just creating too many logger.warnings and therefore overflows the variable {var} - what do you think @ponceta

@PeterZamudio and Sandro:

@ponceta
Copy link
Member

ponceta commented Oct 25, 2024

I can't figure out what's wrong with python but from what I see you have remark fields that are over the limit of 80 characters.

Maybe that's indeed the {val} or {max_length} which is creating trouble.

What I see here is that we have a warning which makes the application crash, this is not great in terms of stability.

@domi4484 add a unit test for this stacklevel argument in QGEP/qgepqwat2ili#170 (comment) so it should not fail so easily.

We should maybe create such errors in an INTERLIS and a demodata file (with and without errors) to check that the application is handling well these error scenarii as we did with QGEP.

@domi4484
Copy link
Contributor

Is that with the latest version of the plugin? looking at the line numbers in the stack trace I would say not

@ponceta
Copy link
Member

ponceta commented Oct 25, 2024

I tried with latest release and it works as expected :

2024-10-25T16:29:21        teksi_wastewater.utils:Value 'Alte Bezeichnung: SH1 AND a very very very very very ververy very very very very ververy very very very very ververy very very very very ververy very very very very very long remark' exceeds expected length (80)

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