2012-01-07 2 views
1

TypeError: argument of type 'int' is not iterable과 같은 이전 질문과는 달리 내 경우에는 즉시 명백한 색인 문제가없는 것 같습니다.Python 3.2.2 : xmlrpc.client 호출에서 설명 할 수없는 오류 - "int '유형의 인수가 반복 가능하지 않음"

아래 코드에서 testcfg.agents은 호스트 이름 및/또는 IP 주소 목록이고 testcfg.portxmlrpc 호출에 사용해야하는 포트입니다. Active Directory의 DSEvent 클래스는 모델 이벤트 및 DSEvent.eventcommand는 명령 및 매개 변수를 포함하는 목록입니다 (그것이 subprocess 모듈을 사용하여 실행하는 에이전트에 xmlrpc 통화 통과를.)

# Create a list of agents to process events from 
agent_list = [] 
for a in testcfg.agents: 
    agent_list.append(xmlrpc.client.ServerProxy("http://" + a + ':' + testcfg.port)) 

# Initial user creation: 
for j in range(5): 
    init_event = DSEvent(type = 'add', is_important = True) 
    agent_eB = random.choice(agent_list) 
    agent_eB.execute(init_event.eventcommand) # This line throws the fault described below! 

내가 '정확한 예외 모듈로 들어가는 여러 가지 역 추적이 제거 된 모듈이 있습니다.

xmlrpc.client.Fault: <Fault 1: "<class 'TypeError'>:argument of type 'int' is not iterable"> 

이 결함의 출처를 이해할 수 없습니다. init_event.eventcommand은 반복 가능한 객체 (목록)이지만이 오류가 발생하지 않고 다른 코드의 xmlrpc을 통해 반복 가능한 객체를 반환했습니다. 실수로 변수를 재사용했는지 확인했는데 문제가 있다고 생각하지 않습니다. 나는 약간의 도움을 정말로 여기에서 좋아할 것이다! 내가 해결했다고 생각

Traceback (most recent call last): 
    File "C:\Users\Administrator\Downloads\randeventmaker\randeventmakerengine.py", 
line 861, in <module> 
    sproxy.execute(initializing_event.eventcommand) 
    File "C:\Python32\lib\xmlrpc\client.py", line 1095, in __call__ 
    return self.__send(self.__name, args) 
    File "C:\Python32\lib\xmlrpc\client.py", line 1423, in __request 
    verbose=self.__verbose 
    File "C:\Python32\lib\xmlrpc\client.py", line 1136, in request 
    return self.single_request(host, handler, request_body, verbose) 
    File "C:\Python32\lib\xmlrpc\client.py", line 1151, in single_request 
    return self.parse_response(resp) 
    File "C:\Python32\lib\xmlrpc\client.py", line 1323, in parse_response 
    return u.close() 
    File "C:\Python32\lib\xmlrpc\client.py", line 667, in close 
    raise Fault(**self._stack[0]) 
xmlrpc.client.Fault: <Fault 1: "<class 'TypeError'>:argument of type 'int' is 
not iterable"> 
+4

"모듈로의 다양한 역 추적은 iterable이 아닌 반복을 시도하는 것이 무엇인지 말해 줄 것이므로 질문에 대답하는 데 좋은 힌트가됩니다." –

+0

나는 이 질문에 대한 완전한 추적. – Kudzu

답변

0

: 참고로

, 여기에 전체이 오류에 대한 역 추적입니다 이 부분적으로는 적어도. 명백하게 원격 함수 만 튜플 인수를 취합니다.

agent_eb.execute((init_event.eventcommand,)) 

agent_eB.execute(init_event.eventcommand) 

을 변경하면이 특정 오류를 해결 한 것으로 보인다.

0
당신은 아마 같은 정수 목록 등의 반복자에 전달해야

...

+0

그건 그렇고,'init_event.eventcommand' ** ** iterable 객체입니다. 'subprocess' 모듈이 작업 할 명령, 매개 변수 및 옵션을 포함하는 목록입니다. '[ 'dsadd', '사용자', new_user_fdn, '-ln', 'Bob', ...]'. – Kudzu

관련 문제