Python : get the current blend file name?


how can I get the current file name? (ex : myfile.blend)
Obviously, the following doesn’t work :

blend_name = <i>Blender</i>.getCurrentFileName()

I am sure the answer is easy, but I couldn’t find it.

Can somebody help? :slight_smile:

Ok, this is what I have done :

def get_filename():
    import Blender, sys
    filename = Blender.Get('filename')
    basename = Blender.sys.basename(filename)

    return basename

Is it the best way?