The first line instructs the system to run this with the Bourne shell, not with the Python interpreter.
Change
#!/bin/sh
to something like
#!/usr/bin/env python
When you run it from your Python IDE, the IDE knows it is a Python script, so it explicitly invokes the Python interpreter, bypassing the instruction on the first line.
See also Shebang on Wikipedia