I’ve created a small, standalone python tool with a user interface window created in PyQT (PySide2 module).
I’m using pyinstaller to create a standalone executable, but whenever I try to run the executable I get this traceback (below).
Traceback (most recent call last):
File "artintegration.py", line 38, in <module>
class SGInteract():
File "artintegration.py", line 54, in SGInteract
sg = shotgun_api3.Shotgun(sgURL, login=sgLogin, password=sgPass)
File "shotgun_api3\shotgun.py", line 677, in __init__
File "shotgun_api3\shotgun.py", line 721, in server_caps
File "shotgun_api3\shotgun.py", line 776, in info
File "shotgun_api3\shotgun.py", line 3232, in _call_rpc
File "shotgun_api3\shotgun.py", line 3372, in _make_call
File "shotgun_api3\shotgun.py", line 3426, in _http_request
File "shotgun_api3\lib\httplib2\python3\__init__.py", line 1763, in request
File "shotgun_api3\lib\httplib2\python3\__init__.py", line 1239, in __init__
File "shotgun_api3\lib\httplib2\python3\__init__.py", line 194, in _build_ssl_context
FileNotFoundError: [Errno 2] No such file or directory
This is the code at that location in the Shotgun API code:
def _build_ssl_context(
disable_ssl_certificate_validation, ca_certs, cert_file=None, key_file=None,
maximum_version=None, minimum_version=None, key_password=None,
):
if not hasattr(ssl, "SSLContext"):
raise RuntimeError("httplib2 requires Python 3.2+ for ssl.SSLContext")
context = ssl.SSLContext(DEFAULT_TLS_VERSION)
context.verify_mode = (
ssl.CERT_NONE if disable_ssl_certificate_validation else ssl.CERT_REQUIRED
)
# SSLContext.maximum_version and SSLContext.minimum_version are python 3.7+.
# source: https://docs.python.org/3/library/ssl.html#ssl.SSLContext.maximum_version
if maximum_version is not None:
if hasattr(context, "maximum_version"):
context.maximum_version = getattr(ssl.TLSVersion, maximum_version)
else:
...
This happens whether I use the “One Directory” (–onedir) or the “One File” (–onefile) options.
These are the commands I’ve used:
pyinstaller --onedir --windowed --hiddenimport xmlrpc --hiddenimport xmlrpc.client --debug all -y artintegration.py
pyinstaller --onefile --windowed --hiddenimport xmlrpc --hiddenimport xmlrpc.client --debug all -y artintegration.py
Is it that it can’t find the path to the stored SSL Certificates?