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

"TypeError: 'str' object is not callable" in filereader.py #127

Open
gsaviane opened this issue Feb 18, 2023 · 2 comments
Open

"TypeError: 'str' object is not callable" in filereader.py #127

gsaviane opened this issue Feb 18, 2023 · 2 comments

Comments

@gsaviane
Copy link

I'm using FileReader to read telegrams from stdin. If a telegram has a checksum error it throws an exception, but the exception handling throws this:

Traceback (most recent call last):

File "/home/pi/dsmr2mqtt.py", line 101, in
for telegram in telegrams:
File "/home/pi/.local/lib/python3.9/site-packages/dsmr_parser/clients/filereader.py", line 126, in read_as_object
logger.warning(str(e))
TypeError: 'str' object is not callable

I'm not a Pyhon expert, but it seems the str object gets overridden (lines 116-128 of filereader.py):

    with fileinput.input(mode='rb') as file_handle:
        while True:
            data = file_handle.readline()
            str = data.decode()
            self.telegram_buffer.append(str)

            for telegram in self.telegram_buffer.get_all():
                try:
                    yield Telegram(telegram, self.telegram_parser, self.telegram_specification)
                except InvalidChecksumError as e:
                    logger.warning(str(e))
                except ParseError as e:
                    logger.error('Failed to parse telegram: %s', e)
@ndokter
Copy link
Owner

ndokter commented Feb 18, 2023

Thank you for bringing this up. This however is caused by the same issue as #122

Im currently almost done with changes in #121 which should also fix this issue

@ndokter ndokter closed this as completed Feb 18, 2023
@ndokter ndokter reopened this Feb 20, 2023
@ndokter
Copy link
Owner

ndokter commented Feb 20, 2023

I'm sorry, i misread. This should indeed be fixed

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