Fixed attribute error on dirname call on os module.

Fixed attribute error on dirname call on os module.