<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi,</p>
<p>I'm unable to start my Python 3.5.1 + Qt 5.5.1 Windows binary
which I created using pyqtdeploy v1.2.1.</p>
<p>My project/source structure is as follows:</p>
<p>C:\codeprojects\myproject\sources\subproject1 < contains the
source code of my project, also the entry point and all the Qt UI
stuff. Uses also code from
C:\codeprojects\myproject\sources\subproject2<br>
C:\codeprojects\myproject\sources\subproject2 < a different
project (like a library)</p>
<p>The C:\codeprojects\myproject\sources\ directory as well as all
relevant sub-directories are <b>packages</b>, i.e. I did put a
__init__.py file in each of these.<br>
</p>
<p>When I work in the IDE (Pycharm), I set both the subproject1 and
subproject2 as sources root (so PyCharm puts them into sys.path).</p>
<p>I have done the following in pyqtdeploy:</p>
<ul>
<li>Clicked on scan and selected
C:\codeprojects\myproject\sources (because I need the code of
both subproject1 and 2, so I selected the directory that is one
level higher), clicked on "Include all" and removed the
checkboxes of those sub-packages that I don't need to be
distributed (e.g. Test-Suite code)</li>
<li>Entered this into "Entry point":
sources.subproject1.main_gui:main</li>
<li>I left the "Main script file" form field empty<br>
</li>
<li>Entered this into sys.path (without quotes):
":/sources/subproject1 :/sources/subproject2" (space-delimited
list)<br>
</li>
</ul>
<p>When freezing the application, this creates a <b>build</b>
directory next to my pyqtdeploy project file, inside that build
directory the <b>resources</b> directory has the <b>sources</b>
dir (among others) which contains the frozen pyo files, as
expected.</p>
<p>When I try to start my exe file, I get the following output:<br>
Traceback (most recent call last):<br>
File "bootstrap.py", line 969, in _find_and_load<br>
File "bootstrap.py", line 958, in _find_and_load_unlocked<br>
File "bootstrap.py", line 664, in _load_unlocked<br>
File "bootstrap.py", line 634, in _load_backward_compatible<br>
File ":/sources/subproject1/main_gui.py", line 4, in
<module><br>
File "bootstrap.py", line 969, in _find_and_load<br>
File "bootstrap.py", line 944, in _find_and_load_unlocked<br>
File "bootstrap.py", line 222, in _call_with_frames_removed<br>
File "bootstrap.py", line 969, in _find_and_load<br>
File "bootstrap.py", line 956, in _find_and_load_unlocked<br>
ImportError: No module named 'gui_simple'</p>
<p>This is what line 4 of subproject1/main_gui.py looks like: <br>
</p>
<p>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</p>
<pre style="background-color:#ffffff;color:#000000;font-family:'Courier New';font-size:9,0pt;"><span style="color:#000080;font-weight:bold;">from </span>gui_simple.mainwindow <span style="color:#000080;font-weight:bold;">import </span>MyMainWindow</pre>
<p>The corresponding directory and file is located at:</p>
<p>C:\codeprojects\myproject\sources\subproject1\gui_simple\mainwindow.py</p>
<p>So it should be correct that this line looks for a package or
module named "gui_simple" (rather than
"sources.subproject1.gui_simple..."), because it should really be
found (due to setting sys.path).<br>
</p>
<p>I also checked what sys.path looks like (by doing a <b>import
sys + print(str(sys.path)) </b>). This is the output, I don't
know whether this is fine or not:</p>
<p>[':/', ':\\sources\\subproject1', ':\\sources\\subproject2']</p>
<p>Any ideas?</p>
<p>The only way the import works is if I replace <br>
</p>
<pre style="background-color:#ffffff;color:#000000;font-family:'Courier New';font-size:9,0pt;"><span style="color:#000080;font-weight:bold;">from </span>gui_simple.mainwindow <span style="color:#000080;font-weight:bold;">import </span>MyMainWindow</pre>
<p>with</p>
<pre style="background-color:#ffffff;color:#000000;font-family:'Courier New';font-size:9,0pt;"><span style="color:#000080;font-weight:bold;">from </span>sources.subproject1.gui_simple.mainwindow <span style="color:#000080;font-weight:bold;">import </span>MyMainWindow</pre>
<p>But I really don't want to do that. This is what sys.path is for,
after all!!</p>
<p>Cheers!<br>
Marius</p>
<p>Note: injecting <b>help('modules')</b> into my
subproject1\main_gui.py (to be able to discover which modules are
available) also failed with "NameError: name 'help' is not
defined"
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</p>
</body>
</html>