weird -- i remember leaving path_leaf for some reason in this spot, but it appears to be working now so have changed. also changing the variable name to base_name to be consistent with python