-
Notifications
You must be signed in to change notification settings - Fork 113
pyinstaller issue with qtmodern #62
Comments
Hi, as noted in that bug report this have nothing to do with qtmodern so we are not able to fix it. What happens is that pyinstaller does not know about the files that qtmodern uses without you explicitly telling pyinstaller about them, as far as I know there is no way for us to add something in qtmodern to fix it for everyone. That said let's see if we can help you with your issue.
Yes, it is python code. Which is what the Both of the code block should be pretty much copy and paste into the given locations. The only thing you need to make sure is that the
I am not sure but I think pyinstaller unpack your resources to be able to use them
Should be possible, this answer on stack overflow goes through how to add data with the If you have a link to your project I can take a look if you are having problems still. |
Actually, you can provide a hook in your package to handle this. the from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("qtmodern", includes=["**/*.qss"]) And there's no need to check at runtime for the resources position as the previous workaround. An alternative would be to add the hook to pyinstaller-hooks-contrib. @NetinhoDaCosta in the meantime, you can create the |
Awsome find @sanzoghenzo Would you mind creating a PR for qtmodern over there? |
Sure! I'm on it. I opened an issue because I don't know how to handle the optional qt wrappers dependencies and make the test pass. |
Simpler than I thought, we pick PyQt5 and run the test with it. |
PR merged, too bad that they released a new version just yesterday... |
In this post: #34 (comment)
That part with the "import importlib etc... "
Do you add that in the .spec file?
Looks like python code
I did add the bottom part/code-block in the main python code of my application.
Only attempting to figure out how to use that top part.
(adding it in either the spec file, or my main python file, still keeps the same error when opening the .exe file)
That error is:
Traceback (most recent call last):
File "my_filename.py", line 262, in (this number differs depending on my app/code)
File "qtmodern\styles.py", line 70, in dark
File "qtmodern\styles.py", line 23, in _apply_base_theme
FileNotFoundError: [Errno 2] No such file or directory: " 'C:\sers\MyName\AppData\Local\Temp_MEI166802\qtmodern\resources/styles.qss'
[36020] failed to execute script my_filename
I have been encountering this problem for quite some time now. This is a good looking style, would love to be able to use it, and get it working. I have the following questions:
I'm also not sure why it looks for that file in the Temp directory? because of MEIPASS?
Would it be possible to add these files using pyinstaller commands? like '--paths' or '--add--data' or '--resource' or '--additional-hooks-dir' for example?
Any help to get this working would be hugely appreciated.
The text was updated successfully, but these errors were encountered: