Выдает ошибку AttributeError: 'NoneType' object has no attribute 'sort' (#Open song file)


import wave
import time
import pyautogui
import playsound
import threading

# Configure typing speed
pyautogui.PAUSE = 0

# Song filename
filename = 'godzilla.wav'
# Song lyrics
lyrics = "Fill 'em with the venom and eliminate 'em Other words, I Minute Maid 'em I don't wanna hurt 'em, but I did, I'm in a fit of rage I'm murderin' again, nobody will evade I'm fittin' to kill 'em and dumpin' their fuckin' bodies in the lake Obliterating everything, incinerate a renegade I'm here to make anybody who want it with the pen afraid But don't nobody want it, but they're gonna get it anyway 'Cause I'm beginnin' to feel like I'm mentally ill I'm Attila, kill or be killed, I'm a killer bee, the vanilla gorilla You're bringin' the killer within me outta me You don't wanna be the enemy of the demon who entered me Or be on the receivin' end of me, what stupidity it'd be Every bit of me's the epitome of a spitter When I'm in the vicinity, motherfucker, you better duck Or you finna be dead the minute you run into me A hundred percent of you is a fifth of a percent of me I'm 'bout to fuckin' finish you, bitch, I'm unfadable You wanna battle, I'm available, I'm blown up like an inflatable I'm undebatable, I'm unavoidable, I'm unevadable I'm on the toilet bowl, I got a trailer full of money and I'm paid in full I'm not afraid to pull a— Man, stop Look what I'm plannin', haha"

# Generate word list
word_list = lyrics.split()

# Open song file
song = wave.open(filename)
markers = song.getmarkers()
markers.sort()


# Gather times for markers
pre_times = []
accumulation = 0.0
for marker in markers:
    pre_times.append(float(marker)/44100.0 - sum(pre_times))


# Adjust times for markers
times = []
accumulation = 0.0
for index in range(len(pre_times)):

    # Adjusted time difference
    difference = pre_times[index]
    difference -= 0.044
    difference -= (0.014 * len(word_list[index]))
    difference += accumulation  
    if difference < 0.0:
        accumulation = difference
        times.append(0.0)
    else:
        times.append(difference)
        accumulation = 0.0
    print(accumulation)
print(markers)
print(times)

# Play musci on another threade'
def playmusic():
    playsound._playsoundOSX(filename)

threading.Thread(target=playmusic).start()

#iterate though markers
for index in range(len(times)):
    time.sleep(times(index))
    pyautogui.write(word_list(index))
    pyautogui.press("enter")```

Ответы (0 шт):