0

I recently tried to build an installer of a python application built with PyQt5. Unfortunately, after getting the installer via .cfg file and installing it on another computer the script does not start by clicking the shortcut in the (Windows) start menu.

When trying to start the Python-script directly by double-clicking it in the according folder of the installation, Python keeps crashing since PyQt5 is not installed on the computer (although it can be found in the installation-folder). In case I manually install the package via pip install PyQt5 it works when clicking on the script, but not when using the shortcut in the menu.

I suppose this could have to do with the automatically generated file path of the shortcut, but I could not find a solution how to fix it when building the installer. I used script instead of entry_point for it - could it be that this produces my problem?

Thank you in advance!

Here is what my .cfg script looks like:

[Application]
name=sample_name
version=V0.1
publisher=sample_publisher
script=C:\path to Python script\launch_script.pyw
icon=sample_icon.ico

[Python]
version=3.6.3

[Include]
pypi_wheels=PyQt5==5.10

files=folder_with_additional_scripts

[Build]
directory=build\
alex_555
  • 1,092
  • 1
  • 14
  • 27
  • 1
    `entry_point` is strongly recommended if possible. Have a look at [the examples](https://github.com/takluyver/pynsist/tree/master/examples) to see how to use it. If you're using `script` instead, you need to ensure the script has at least the boilerplate [described in the docs](http://pynsist.readthedocs.io/en/latest/cfgfile.html#application-section). – Thomas K Feb 15 '18 at 08:48
  • Thanks for the answer! Solved the problem just a minute ago. Basically, it works when using script, but the actual mistake was to assume that `pynsist` would automatically install `PyQt5`. I had to include a section in the `Python` script that installs the package if not available on the computer. Now, everything works fine! – alex_555 Feb 15 '18 at 10:51
  • 1
    Pynsist should bundle PyQt5 so long as you're specifying it in the config file, which you are. But for the application to find it, you have to include `sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pkgs'))`. When you use `entry_point`, it does that for you. – Thomas K Feb 15 '18 at 14:16
  • Ah thanks, that works better than the pip command in the script! However, I'll switch to `entry_point` - that's the far better solution! Thanks for the suggestion! – alex_555 Feb 16 '18 at 13:05

0 Answers0