Are you using Python 3? The <> operator in Python 2 is considered bad form, and was removed in Python 3. Use != instead.
Due to the reasons discussed here
we will be moving to python-forum.io
on October 1, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.