pyqtdeploy: files not packages as defined in pdt file

Frans Fürst frans.fuerst at protonmail.com
Mon Jan 25 15:41:07 GMT 2021


Hello community,

I seem to have some problems using the `pyqtdeploy`-UI. I try to specify files for a small project with the following file structure:

.
├── pyqt5-template
├── pyqt5-template.pdt
└── application
├── __init__.py
└── ui
├── __init__.py
├── mainwindow.ui
└── mainwindow.py

I tried to create a project file from scratch step by step using pyqtdeploy 3.1.0

1: run pyqtdeploy: $ pyqtdeploy myapp.pdt

Here is the 1st strange thing: I get an error, when I don't provide a project file name and the
file also has to exist - isn't there a way to start without a project file?

2: copy project file from demo, rename it to myapp.pdt
3: provide main script and standard-Packages
4: "Remove all" to start clean
5: "Scan.." => select folder 'application' => add required files
6: Save & exit

Strange thing 2: absolute path will be added to the package, so the project file contains the
following package definition:

> [Application.Package]
> name = "/home/me/myapp/application"
> exclude = [ "*.pyc", "*.pyd", "*.pyo", "*.pyx", "*.pxi", "__pycache__", "*-info", "EGG_INFO", "*.so",]
> [[Application.Package.Content]]
> name = "__init__.py"
> included = true
> is_directory = false

Despite this is not portable from machine to machine, building and running the app doesn't work neither: _some_ (but not all) files will report

> shutil.SameFileError: '/home/me/myapp/application/ui/mainwindow.ui' and '/home/me/myapp/application/ui/mainwindow.ui'

if I remove mainwindow.ui from the project compilation succeedes but running it will get me:

> ModuleNotFoundError: No module named 'application'

4: So I strip the path manually:

> [Application.Package]
> name = "application"
> exclude = [ "*.pyc", "*.pyd", "*.pyo", "*.pyx", "*.pxi", "__pycache__", "*-info", "EGG_INFO", "*.so",]
> [[Application.Package.Content]]
> name = "__init__.py"
> included = true
> is_directory = false
>
> [[Application.Package.Content]]
> name = "ui"
> included = true
> is_directory = true
>
> [[Application.Package.Content.Content]]
> name = "__init__.py"
> included = true
> is_directory = false
>
> [[Application.Package.Content.Content]]
> name = "mainwindow.py"
> included = true
> is_directory = false
>
> [[Application.Package.Content.Content]]
> name = "mainwindow.ui"
> included = true
> is_directory = false

Now the application compiles successfully but when I run it I get

> ModuleNotFoundError: No module named 'application.ui.mainwindow'

which is caused by

> from .mainwindow import MainWindow

inside application.ui.__init__.py

I tried to import application.ui.mainwindow in different ways without success, so I opened the binary in a hex editor and found out that the only three files seem to be those:

├── pyqt5-template
└── application
├── __init__.py
└── ui
└── __init__.py

but __main__.py, mainwindow.py and mainwindow.ui are missing.

What have I done wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210125/6c2a0c2d/attachment-0001.htm>


More information about the PyQt mailing list