Seems a variable named errno was used which took over the namespace
of the imported errno module. Needed to remove the local variable to
avoid clash.