Splitting python path using os.path module
Avoid using "/" at the end of the directory paths as they would generate empty filename when used with functions like os.path.split() > > > import os > > > os . path . split ( '/tmp/foo' ) ( '/tmp' , 'foo' ) > > > os . path . split ( '/tmp/foo/' ) ( '/tmp/foo' , '' ) Reference: https://docs.python.org/2/library/os.path.html