I using the mido module to read file with this code.
import mido def maxtick(relative_path_to_file): song=readSong(relative_path_to_file) tpb=song.ti