Web.py and PyInstaller: issues with HTTPS on 32-bit Windows machines

I recently had a project where I had to bundle a Windows app, written in Python 2.7. I chose to use PyInstaller 3.2, since it was being used for other parts of our project as well.

The app had to be light-weight and compatible with older, 32-bit Windows machines, since it was going to be deployed on 10+ year old hardware in rural areas (running 32-bit Windows XP). The app basically provided a local, RESTful assessment engine, allowing students to interactively answer various types of questions (Multiple Choice, Fill-in-the-Blank, etc.) using the open source Open Embedded Assessments tool. To make it as light-weight as possible, I had decided to use the Web.py server.

While the app bundled fine on a 64-bit Windows 10 VM, I kept running into an error on a 32-bit Windows 10 VM:

    You must install pyOpenSSL to use HTTPS.

The app ran fine from the command prompt, and using a Python shell, I could import OpenSSL manually, so I was stumped. I finally dug into the PyInstaller warnings file and realized that Web.py was masking a common issue with _cffi_backend not being declared as a hidden import. Adding that to my spec file solved it, and I could cleanly build my app in 32-bit Windows.

I’m not entirely sure why the same spec file (without the _cffi_backend hidden import) worked fine in 64-bits, but that’s another mystery for another day.