user2119807
user2119807

Reputation: 33

SyntaxWarning: import * only allowed at module level

I am trying to make someone else program work. I have no experience of Python. I would appreciate if someone could help me here. I get the following error with python 2.6:

WSHSP.py:598: SyntaxWarning: import * only allowed at module level
  def drawComposition(self, solution, goalService):
WSHSP.py:598: SyntaxWarning: import * only allowed at module level
  def drawComposition(self, solution, goalService):
C:\WSPR\WebServicePath.py:3: DeprecationWarning: the sets module is deprecated
  from sets import Set

here is the code:

def SMxmlPrint(self, solution, goalService, node_case):
    parent = node_case
    OPEN = []
    CLOSE =[]
    OPEN = solution
    itr = 1
    state = set(goalService.inputList)
    for t in goalService.inputList:
        if self.typeTable.has_key(t):
            state |= set(self.typeTable[t])

    while True:
        for ws in OPEN:
            if set(self.webServiceList[ws].inputList).issubset(state):                    
                CLOSE.append(ws)
                parent = self.appendChildNode(parent, str(itr), ws)
                itr +=1
        for ws in CLOSE:
            state = state.union(self.webServiceList[ws].outputList)
            for t in self.webServiceList[ws].outputList:
                if self.typeTable.has_key(t):
                    state |= set(self.typeTable[t])

        OPEN =  list ( Set(solution).difference(Set(CLOSE)) )

        if len(OPEN) is 0:
            break

def drawComposition(self, solution, goalService):
    try:
        from pylab import *
    except:
        print ("pylab not found: see https://networkx.lanl.gov/Drawing.html for info")
        raise 

    from networkx import *

Upvotes: 0

Views: 5553

Answers (1)

Kevin
Kevin

Reputation: 76194

I don't think it's a good idea to ignore warnings, but if you simply must get it out of your sight, you can use the -W flag on the command line:

python -W ignore your_script_name.py

Upvotes: 1

Related Questions