How to remove "where from" xattr data from image files downloaded in Mac?
Your command works for me, even copying it and supplying an appropriate filename. As suggested in the comments, you need to ensure that the correct filepath is being supplied, and that the file has the attribute to start with.

You can see whether the file has the attribute in a number of ways:

ls -l@ /path/to/filename


Or:

xattr /path/to/filename