# Is there any difference between bpy.path.basename and os.path.basename?

According to the docs for bpy.path.basename:

Equivalent to os.path.basename, but skips a “//” prefix.

Use for Windows compatibility.

But on Windows, I don't see any difference between it and os.path.basename.

Are there any cases where the two functions will give different output?

os.path.basename doesn't understand Blender's // prefix (denoting a path relative to the current blend file). bpy.path.basename does understand this. If your path is (or could be) a blend-file-relative path, use the bpy.path.* functions.
• So the only edge case I was able to find was os.path.basename('//dir/file.txt') gives '' instead of 'file.txt'. os.path.basename('//dir/dir2/file.txt') and os.path.basename('//file.txt') both work correctly. – Isaac Nov 12 '17 at 22:25