Fix for pyqtdeploy-build bug on windows when folder and module have same name

Patrick Stinson patrickkidd at gmail.com
Wed Oct 14 08:58:06 BST 2020


My windows build was exiting silently with error code one. There was no error printed on this one either at the C++ level in pyqtdeploy_main or in pyqtdeploy.builder.builder so I ended up having to debug both layers for a while to figure it out. Eventually I figured out that pdytools_module.cpp:find_module couldn’t find my module “pkdiagram.debug”.

Turns out the module was never added to the project.

Turns out pyqtdpeloy.builder.builder silently ignores a python app module added to the pyqtdeploy project if a folder exists with the same filename. In my case I had a debug.py in my app module and also had a “debug” folder in the app module folder.

I added this poorly chosen exception to builder.builder to point it out. I do think it should fail if the file isn’t found since it was explicitly added in the project:

diff --git a/builder/builder.py b/builder/builder.py
index 62ee74a..b50e59b 100644
--- a/builder/builder.py
+++ b/builder/builder.py
@@ -536,6 +536,8 @@ int main(int argc, char **argv)
             # simple directory.
             if os.path.isfile(src_path):
                 to_freeze.append((src_path, dst_name))
+            else:
+                raise RuntimeError("Skipping freezing module: %s, because file not found: %s" % (name, src_path))

         elif isinstance(part, PythonPackage):
             root = os.path.join(part_root_dir, src_name)

I imagine some error reporting could go a long way at both the C++ and python levels.

Cheers,
-Patrick


More information about the PyQt mailing list