Python fbs - module imports don't work after freeze

Viewed 2135

I made an application with fbs and pyqt5. If I execute python3 -m fbs run the application starts without problems. However if I run python3 -m fbs freeze and execute the created executable (./myprogram), the following error occurs:

Traceback (most recent call last):
  File "python/main.py", line 2, in <module>
ModuleNotFoundError: No module named 'controller'
[28713] Failed to execute script main

This is how my main.py file looks like:

from fbs_runtime.application_context import ApplicationContext
from controller import FieldPresenter

import sys

class AppContext(ApplicationContext):
...

This is my folder structure:

python:
    - main.py
    controller:
        - __init__.py
        - FieldPresenter.py

This is the init.py in the folder controller:

from .FieldPresenter import FieldPresenter

The other init.py is empty

1 Answers

I was having the same issue. Then I fixed it by removing the __init__.py in the python directory.

Related