When I try to import passlib.hash in my python script I get a 502 error
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
The only modules I'm importing are:
import cgi, cgitb
import passlib.hash
passlib.hash works fine when I try in a normal python script or if I try importing in python interactive shell
using python 2.7, iis 8
when I browse on the localhost I get this 
HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Traceback (most recent call last): File "C:##path remove##\test.py", line 2, in  import passlib.hash ImportError: No module named passlib.hash ".
I fixed the issue by uninstalling activePython which was installing modules under the users profile in the appdata folder. 
This caused an issue where the anonymous isur of the website it no longer had access to the installed modules 
I uninstall activePython and returned to the normal windows python install and re-installed the modules using PIP.
All scripts are working as expected, happy days.
Importing passlib.hash with CGI