From the definition of the IP_ADD_MEMBERSHIP option, the first address is a multicast group address and the second is an interface address.
You are using 127.0.0.1 as the first address. This is not a multicast address.
Multicast addresses are in the range 224.0.0.0/4 (i.e. 224.0.0.1 to 239.255.255.254, not including network and broadcast addresses).
For example, using the first (all hosts on same network segment) multicast address works just fine:
>>> s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
>>> s.setsockopt(socket.SOL_IP,socket.IP_ADD_MEMBERSHIP,
socket.inet_aton('224.0.0.1')+socket.inet_aton('0.0.0.0'))
Check this reference for more information about multicast addresses.
So you need to choose an unassigned multicast address in 224/4 for your application and use that (e.g. anything in the ad-hoc range, like 244.0.2.0). Note the multicast address has nothing to do with the interface address (using '0.0.0.0', you associate all local interfaces with the multicast address, meaning all interfaces can be used to receive/send multicast packets for that group).