简体   繁体   中英

shotgun_api3 not working in PyInstaller exe build

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'

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM