Help with a small script i am trying to write

Paul Cresswell
Paul Cresswell used Ask the Experts™
on
Hi, I am trying to write a python script that will tweet the name and artist of a song when it plays. I have achieved this but the problem I have is when the player stops or I pause or forward the song the script crashes.
My code so far is

lastSong = None
while True:
   currentSong = client.currentsong()
   if currentSong != lastSong:
        api.update_status(status= currentSong['artist'] + " - " + currentSong['title'] + "\n" + "#NowPlaying" + " #" +  currentSong['artist'].translate(None, whitespace))
        lastSong = currentSong
time.sleep(59) #change this to however often you wanna poll.

Any help would be great. Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You're not giving us anything to work on here.
To start, what are client and api?
On what platform is this running?
OP is inactive

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial