Question: When executing:

```
path=os.path.dirname(__file__)+'/log.txt'
log=open(path,"w",encoding='utf-8')

```

I get:

```
log=open(path,'w',encoding='utf-8')
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1203, in __init__
raise IOError('invalid mode: %s' % mode)
IOError: invalid mode: w

```

I'm not sure why I can't write to the file?

Answer: 
There is no [documented method](http://developer.android.com/reference/android/media/MediaPlayer.html) for getting info on the currently playing file from a MediaPlayer instance, you'll need to make your app store that information itself in another way. If you're using a Service to keep track of your MediaPlayer instance (which I'd recommend) then this shouldn't be too hard.
I think you need to have your own model classes from wherein you can set and get your song title. For this and other information, see Stack Overflow question:  

[How to set the PlayList Index for Mediaplayer(ExpressionMediaPlayer:Mediaplayer)](https://stackoverflow.com/questions/2780295/how-to-set-the-playlist-index-for-mediaplayerexpressionmediaplayermediaplayer).

If you are keen to know how it is being implemented, you can get the [source](https://android.googlesource.com/platform/packages/apps/Music/+/master) and see how they have implemented.