Update maven.py

changed try/else to hasattr() due to self-registration of Attribute exception.