shotgun_api3 not working in PyInstaller exe build

293 Views Asked by At

This is my run.py file, it works perfectly fine if you run it manually with something like py -3 run.py

import shotgun_api3

I use Python 3 to build the .exe using PyInstaller:

py -3 -m PyInstaller run.py

The build completes successfully. When I try to run the .exe I get this error:

ModuleNotFoundError: No module named 'xmlrpc'

So I tried adding import xmlrpc above the import shotgun_api3 in my run.py, then the error changed to this:

ModuleNotFoundError: No module named 'xmlrpc.client'
2

There are 2 best solutions below

0
ilya radovilsky On

Definitely not the best solution, but I managed to build the executable. I had to remove httplib2 and six from shotgun api, pip-installed them by myself and updated imports in shotgun.py.

0
anongrider On

I had to add them as hidden imports as well as a few others:

pyinstaller --hidden-import urllib2 --hidden-import xmlrpc --hidden-import xmlrpc.client --hidden-import xmlrpclib --hidden-import cookielib main.py