The folks over at Insomniac Games were recently met with the challenge of getting Maya 2009 on Windows to be able to talk to their Shotgun server via Shotgun API. Through some trial and error, they solved the issue and seeing that it can be incredibly frustrating to try and find solutions like these on the internetz, they offered up the process to the Shotgun community to hopefully prevent others from hours lost clawing their eyes out trying to solve the issues.
Maya 2009 ships with Python v2.5.1 which does not include the SSL module. SSL was added as a standard module to Python in version 2.6. Their Shotgun server runs over https (as most do). So attempts to connect to their Shotgun server using the Shotgun API would fail with the following error:
# Error: 'module' object has no attribute 'ssl'
One solution was to open up http access to their server for the API only while leaving https connections for the user interaction in tact. But this isn't ideal and they didn't want to do that. So instead, we focused on trying to solve the problem by downloading, compiling, and installing the ssl module manually. On Windows this can be a tricky process.
As a general rule, I used the instructions here: http://malei39.blogspot.com/2010/02/install-ssl-module-for-pyhon-254.html. There was a long list of “gotchas” along the way. A lot of these, however, were the product of my unfamiliarity with both Linux and Python.
Build OpenSSL and libgw32c
- Download OpenSSL (http://gnuwin32.sourceforge.net/packages/openssl.htm) and libgw32c (http://gnuwin32.sourceforge.net/packages/libgw32c.htm) sources.
Build openssl using the instructions found in
* Note that before running
‘nmake –f ms\ntdll.mak’I had to run
‘vcvars’from a command-line. This batch file setups up environment variables for the VS tools.
- Copy the libs and dlls to the appropriate folders.
Build Python SSL
- Download and install Python 2.5.4 (http://www.python.org/getit/releases/2.5.4/).
- Install MinGW (http://www.mingw.org/) full to get compilers.
- Add the MinGW bin to your path.
- Point Python25 at the mingw32 compiler.
- Download and install Python SSL 1.15 (http://pypi.python.org/pypi/ssl).
- Before doing anything, edit
<PYTHON>\lib\distutils\cygwincompiler.pyand remove the
- At this point, you should be able to go through the 3 steps in the “Let build it” section on the web page above:
- Go to directory you have extracted the source code
To build the only, run command
python setup.py build
To build and install, run command
python setup.py install
To build the installer, run command
python setup.py bdist_wininst
Install Python SSL
- Download and install Python setuptools 0.6c11. This is required so you can use easy_install on ssl.
‘easy_install ssl’. If things are configured correctly, this should install SSL to Python.
I ended up adding the ssl files to the shotgun_api3 distro so we could easily deploy it to users on the team.