Python: communicator not destroyed during global destruction

1.9k views Asked by At

When I try to execute the following python script with:

/usr/bin/python /var/www/html/iPhone/inarrivo/python/addMurmurChannel.py 14 I receive error: communicator not destroyed during global destruction.

What is the communicator and how I destroy it?

#!/usr/bin/python
import Ice
import inspect
import sys
#Ice.loadSlice("/usr/local/murmur/ice/Murmur.ice")
Ice.loadSlice( '', ['-I' + Ice.getSliceDir(), "/usr/local/murmur/ice/Murmur.ice"])
import Murmur
newChannelName=sys.argv[1]
# Init ice
comm = Ice.initialize()
# Let Ice know where to go to connect to mumble
# Let Ice know where to go to connect to mumble
proxy = comm.stringToProxy("Meta -e 1.0:tcp -p 6502")
# Create a dynamic object that allows us to get a programmable interface for Mumble
meta = Murmur.MetaPrx.checkedCast(proxy)
# Get the server instance from the set of servers.
server = meta.getServer(1)
found=False
channels = server.getChannels()
for value in channels.itervalues():
    idChannel=value.id
    if value.name == newChannelName:
            found=True
            break
if found==False:
    server.addChannel(newChannelName, 0)
1

There are 1 answers

3
eleq On BEST ANSWER

When calling

ic = Ice.initialize()

a communicator is created. you can destroy it like this:

if ic:
    # Clean up
    try:
        ic.destroy()
    except:
        traceback.print_exc()
        status = 1

refrence: https://doc.zeroc.com/display/Ice36/Writing+an+Ice+Application+with+Python#WritinganIceApplicationwithPython-WritingaClientinPython