1

Unlike previous questions like TypeError: argument of type 'int' is not iterable there doesn't seem to be an immediately obvious indexing problem in my case.

In the code below, testcfg.agents is a list of hostnames and/or IP addresses, and testcfg.port is the port which xmlrpc calls should use. The DSEvent class models events in Active Directory, and DSEvent.eventcommand is a list containing a command and its parameters (passed through xmlrpc calls to an agent, which executes it using the subprocess module.)

# 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!

The exact exception I'm getting is (with various tracebacks into the module stripped out):

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

I can't understand where this fault might be coming from. While init_event.eventcommand is an iterable object (a list) I've passed and returned iterable objects via xmlrpc in other code without encountering this error. I've checked for accidental variable reuse, and I don't think that's the problem either. I'd really love some help here!

For reference, here's the full traceback for this error:

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">
2
  • 4
    I would think that the "various tracebacks into the module" would tell you what exactly it's trying to iterate over that's not iterable, and would thus be a good hint to answering the question.... Commented Jan 7, 2012 at 4:23
  • I've appended the full traceback to this question. Commented Jan 7, 2012 at 15:38

2 Answers 2

0

You probably need to pass in an iterable, such as an integer-list...

Sign up to request clarification or add additional context in comments.

1 Comment

That's just it, though: init_event.eventcommand is an iterable object. It's a list containing commands, parameters and options for the subprocess module to work on, e.g. ['dsadd', 'user', new_user_fdn, '-ln', 'Bob', ... ].
0

I think I've solved this, at least partially. Apparently remote functions only take a tuple of arguments. Changing

agent_eB.execute(init_event.eventcommand)

to

agent_eb.execute((init_event.eventcommand,))

seems to have fixed this particular error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.