Help how to rename mesh to the current blend file name

Hello
How to rename mesh to the current blend file name

Thanks

import os.path
filename = os.path.splitext(os.path.split(bp.data.filepath)[1])[0]
if filename:
    # might encode and limit filename length here...
    bpy.context.object.data.name = filename

It works perfectly
The code is missing a letter

import os.path
filename = os.path.splitext(os.path.split(bpy.data.filepath)[1])[0]
if filename:
    # might encode and limit filename length here...
    bpy.context.object.data.name = filename

Thank you very much