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

Python: Make __str__ work for CompileError's diagnostics field #5474

Open
tronical opened this issue Jun 25, 2024 · 2 comments
Open

Python: Make __str__ work for CompileError's diagnostics field #5474

tronical opened this issue Jun 25, 2024 · 2 comments
Labels
a:language-python Python bindings (mS,bO) bug Something isn't working

Comments

@tronical
Copy link
Member

As seen in #5469, when printing the CompileError struct, the diagnostics are not correctly transformed to a readable representation. While __str__ is implemented on PyDiagnostics, somehow it doesn't transcend into the list that's created from it.

Fixing this would make it easier to quickly discover the root cause for a run-time generated Slint compile error.

@tronical tronical added bug Something isn't working a:language-python Python bindings (mS,bO) labels Jun 25, 2024
@cooliean
Copy link

The Demo works, but when packaged with pyinstaller, it doesn't

python 3.10 slint 1.6.0a8
package command : pyinstaller -FD main.py --add-data "appwindow.slint:./"

Traceback (most recent call last):
  File "main.py", line 5, in <module>
  File "slint/__init__.py", line 182, in load_file
slint.CompileError: ('Could not compile appwindow.slint', [<builtins.PyDiagnostic object at 0x109ff1ac0>])
[53112] Failed to execute script 'main' due to unhandled exception!
import slint
components = slint.load_file("appwindow.slint")
main_window = components.MainWindow()
main_window.run()

@tronical
Copy link
Member Author

I think that may be because when passing a relative path to load_file() will it be resolved against the process' working directory. You could try something like this instead: slint.load_file(os.path.join(os.path.dirname(__file__), "appwindow.slint"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:language-python Python bindings (mS,bO) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants