It seems to me that one (partial?) solution would be to wrap each function/method so that any passed object with a __fspath__ method is converted to the result of calling that method. This is essentially the same logic behind os.fspath(), which returns arbitrary strings unchanged, even if they couldn't possibly represent a path. Of course, it sequences of paths must also be covered, that could be accommodated, too. But if there are more complicated scenarios that I haven't anticipated, they may be harder to support. Incidentally, the basic approach I outlined is how I deal with this problem (at an abstract level) when generating scripts on the fly and passing them via propy.bat.
... View more