leopoldhub / fw-fanctrl-gui

simple pyside Qt6 python gui with system tray to control Framework laptops fans with fw-fanctrl
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

No module named src.app #1

Open Svenum opened 2 weeks ago

Svenum commented 2 weeks ago

Hi, I saw this project and would try it on nix, but if I execute it I got this error:

Traceback (most recent call last):
  File "/nix/store/42z1nvysrz95ccwjd4ss2jibf9ch3la7-python3.12-fw-fanctrl-gui-26-08-2024/bin/.fw-fanctrl-gui-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/42z1nvysrz95ccwjd4ss2jibf9ch3la7-python3.12-fw-fanctrl-gui-26-08-2024/lib/python3.12/site-packages/src/__main__.py", line 2, in main
    from .index import start
  File "/nix/store/42z1nvysrz95ccwjd4ss2jibf9ch3la7-python3.12-fw-fanctrl-gui-26-08-2024/lib/python3.12/site-packages/src/index.py", line 7, in <module>
    from src.app.MainWindow import main
ModuleNotFoundError: No module named 'src.app'

Have you any idea?

leopoldhub commented 2 weeks ago

Hi,

The project is still in a very early stage, I am still trying to figure out the project structure and configurations.

The app cannot be executed as is, you need to install it with pip, then execute it with its name (fw-fanctrl-gui), or the command python -m src.

Could you also describe the steps you did to execute it?

leopoldhub commented 2 weeks ago

By the way, who was ChangjingZhang? I saw the messages In my mails but I cannot see them on github and report him.

Svenum commented 2 weeks ago

He is already blocked and github removed the commends

Svenum commented 2 weeks ago

If I replace packages=["src"] with packages=["src", "src.app", "src.service", "src.exception"] in the setup.py it works.

But now I get

QIODevice::read (QFile, "resources/ui/main/main.ui"): device not open
Designer: An error has occurred while reading the UI file at line 1, column 0: Premature end of document.
Traceback (most recent call last):
  File "/nix/store/hps2jabva0rq38wm2g56bpa51zvwfqwz-python3.12-fw-fanctrl-gui-26-08-2024/bin/.fw-fanctrl-gui-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/hps2jabva0rq38wm2g56bpa51zvwfqwz-python3.12-fw-fanctrl-gui-26-08-2024/lib/python3.12/site-packages/src/__main__.py", line 4, in main
    start()
  File "/nix/store/hps2jabva0rq38wm2g56bpa51zvwfqwz-python3.12-fw-fanctrl-gui-26-08-2024/lib/python3.12/site-packages/src/index.py", line 30, in start
    window = main(args, app, fanctrlService)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/hps2jabva0rq38wm2g56bpa51zvwfqwz-python3.12-fw-fanctrl-gui-26-08-2024/lib/python3.12/site-packages/src/app/MainWindow.py", line 170, in main
    window = MainWindow(icon, fanctrlService)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/hps2jabva0rq38wm2g56bpa51zvwfqwz-python3.12-fw-fanctrl-gui-26-08-2024/lib/python3.12/site-packages/src/app/MainWindow.py", line 16, in __init__
    self.ui = QtUiTools.QUiLoader().load("resources/ui/main/main.ui")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Unable to open/read ui device

I think its because the resources folder is not imported.

Svenum commented 2 weeks ago

If I execute the build in the folder where the resources folder is present it works.

leopoldhub commented 2 weeks ago

Thanks, maybe I missed something... I will check that later on, I do not have much time these days 😅

I am also thinking of using PyInstaller to make a one click install without worring about Python version and virtualenv.

Svenum commented 2 weeks ago

Nice. If the nix build work I would love too add the gui as experimental feature to the fw-fanctrl nix flake. Would this ne bine for you?

leopoldhub commented 2 weeks ago

I appreciate the intention, but

  1. We should not make a direct link from fw-fanctrl to this project without @TamtamHero 's approval.
  2. I think it is important to have the project structure ready and conventions defined before actually distributing it, so that we avoid breaking people's configs in future changes.

I will try to have it working properly on all platforms by Tuesday if you want to try it.

TamtamHero commented 5 days ago

Approval granted! Nice job :)

leopoldhub commented 4 days ago

Thanks a lot,

This is a project I can work on without my main pc at hand during this one-month absence, I will do my best to work on it when I find some time :)

It is also an opportunity to work with the standard pip installation (as described in https://github.com/TamtamHero/fw-fanctrl/issues/73) and get it right before implementing it in the core project.

Have a nice day!

leopoldhub commented 4 days ago

(ps. I may not be available during normal hours due to time zones and working hours, If you contact me, I will answer as soon as I can)