Look at the documentation for os.path.join.  uri must not begin with a /.  Use lstrip to remove the slash from it.