Skip to content

Display of error empty: fmbt3-editor tries to search contents of byte String, but should search decoded string instead #81

@BLuedtke

Description

@BLuedtke

Hello everyone,
I'm using the fmbt3-editor for creating python aal models. This issue concerns the devel branch (havent tested master), particularly utils3/fmbt3-editor. I am using Ubuntu 20.04 LTS.

When the model/code I invoke in fmbt3-editor throws an error, the view switches to the error tab. This is expected. There it says "Complete unformatted error output:". However, the error output after that is empty. In the console with which I started fmbt3-editor, I can see the error message being printed though. Interestingly, it is printed as a byte string, with the "b"-prefix.

In method _doGenerateTest of fmbt3-editor, the contents of this error (byte-) string are analyzed. This happens before showError is called, and here in _doGenerateTest, the _test_errormsg has to be set to the error message that should be displayed by showError.
In this method on line 1231 (of fmbt3-editor), it is checked whether some specific strings are contained in the error output (output[1] to be precise). Based on my tests, this check fails, and the method returns directly. However, if I change line 1231 to this:
if fmbt_exitstatus == 0 or "pass:" in output[1].decode('utf-8') or "inconc:" in output[1].decode('utf-8') or "fail:" in output[1].decode('utf-8'):
and change line 1239 to
self._test_errormsg = output[1].decode('utf-8')
then it works. Maybe one would also add a check for whether output[1] is None or Empty, to avoid exceptions here.

It seems like the "string in other string" search does not work if the string to search is a bytestring and not decoded. Now, I am not sure if this will be the same for every operating system. It could also depend on the version of python I suppose. There could also be other valid reasons for not decoding the string, which I haven't discovered yet.
As the fix is relatively easy, I'm fine with just modyfying the fmbt3-editor file on my machine, but fixing this in the repo would be more convenient. I'm kinda busy atm but if my stress cools down a bit, I could also submit a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions