title: TypeError: AutoProxy object is not iterable - multiprocessing
body: <p>consider the following server code : </p>
  
  <pre><code>from multiprocessing.managers import BaseManager, BaseProxy
  
  def baz(aa) :
      print "aaa"
      l = []
      for i in range(3) :
        l.append(aa)
      return l
  
  class SolverManager(BaseManager): pass
  
  manager = SolverManager(address=('127.0.0.1', 50000), authkey='mpm')
  manager.register('solver', baz)
  
  server = manager.get_server()
  server.serve_forever()
  </code></pre>
  
  <p>and the associated client :</p>
  
  <pre><code>import sys
  from multiprocessing.managers import BaseManager, BaseProxy
  
  class SolverManager(BaseManager): pass
  
  def main(args) :
      SolverManager.register('solver')
      m = SolverManager(address=('127.0.0.1', 50000), authkey='mpm')
      m.connect()
  
      for i in m.solver(args[1]):
          print i
  
  if __name__ == '__main__':
      sys.exit(main(sys.argv))
  </code></pre>
  
  <p>I think I'm missing something important here. My guess is that I have to subclass the BaseProxy class to provide an iterable object, but so far I haven't managed to get it right.</p>
  
  <p>when I run the client I get this error :</p>
  
  <pre><code>Traceback (most recent call last):
    File "mpmproxy.py", line 17, in &lt;module&gt;
      sys.exit(main(sys.argv))
    File "mpmproxy.py", line 13, in main
      for i in m.solver(args[1]):
  TypeError: 'AutoProxy[solver]' object is not iterable
  </code></pre>
  
  <p>however if I try to print it, the list is there ... Maybe it has also something to do with the way data is serialized between client and server ...</p>
  
  <p>in the documentation there is a similar case (with a generator) and they use the following class to access the data :</p>
  
  <pre><code>class GeneratorProxy(BaseProxy):
      _exposed_ = ('next', '__next__')
      def __iter__(self):
          return self
      def next(self):
          return self._callmethod('next')
      def __next__(self):
          return self._callmethod('__next__')
  </code></pre>
  
  <p>shall I do something similar ? Can anybody give me an example and explain to me how this works ?</p>
  
  <p><strong>update</strong></p>
  
  <p>To clarify : suppose I add the class :</p>
  
  <pre><code>class IteratorProxy(BaseProxy):
      def __iter__(self):
          print self
          return self
  </code></pre>
  
  <p>and in the client I register the function as</p>
  
  <pre><code>SolverManager.register('solver', proxytype=IteratorProxy)
  </code></pre>
  
  <p>the error I get is :</p>
  
  <pre><code>$python mpmproxy.py test
  ['test', 'test', 'test']
  Traceback (most recent call last):
    File "mpmproxy.py", line 22, in &lt;module&gt;
      sys.exit(main(sys.argv))
    File "mpmproxy.py", line 18, in main
      for i in m.solver(args[1]):
  TypeError: iter() returned non-iterator of type 'IteratorProxy'
  </code></pre>
  
  <p>I have the impression I'm missing something stupid here ...</p>
  
  <p><strong>update 2</strong></p>
  
  <p>I think I solved this problem:</p>
  
  <p>The point was to get the real value :  </p>
  
  <pre><code>for i in m.solver(args[1])._getvalue():
      print i
  </code></pre>
  
  <p>gosh !!! I'm not sure if this is the correct answer or just a workaround ...</p>