Averroes / iniparse

Other
0 stars 0 forks source link

config object are not passable to Queue object from multiprocessing module. #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Python multiprocessing module have very nice Queue class to pass messages 
(objects) between the processed. I've tried to use this to propagate 
configuration changes between the processes. However, INIConfig instances 
have trouble with this.

What steps will reproduce the problem?
1. Place attached my.conf and mysend.py in the same directory.
2. Run python ./mysend.py
3.

What is the expected output? What do you see instead?
I would expect "test1" to be printed. Instead, I see this error messages:
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.5/multiprocessing/queues.py", line 242, 
in _feed
    send(obj)
TypeError: 'Undefined' object is not callable

What version of the product are you using? On what operating system?
I'm using python 2.5.2 on Debian Lenny amd 64 bit. iniparse 0.3.2.

Please provide any additional information below.

Original issue reported on code.google.com by HaiZ...@gmail.com on 4 May 2010 at 1:28

Attachments:

GoogleCodeExporter commented 9 years ago
If you've never heard of multiprocessing module, here is the quick link:
http://docs.python.org/library/multiprocessing.html

Original comment by HaiZ...@gmail.com on 4 May 2010 at 1:37

GoogleCodeExporter commented 9 years ago
I think the underlying problem is with pickling.  It's easy to reproduce:

>>> c=iniparse.INIConfig()
>>> c.x.y = 1
>>> pickle.dumps(c, -1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/pickle.py", line 1366, in dumps
    Pickler(file, protocol).dump(obj)
  File "/usr/lib/python2.6/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/lib/python2.6/pickle.py", line 306, in save
    rv = reduce(self.proto)
TypeError: 'Undefined' object is not callable

Original comment by psobe...@gmail.com on 5 May 2010 at 3:48

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r134.

Original comment by psobe...@gmail.com on 5 May 2010 at 5:32

GoogleCodeExporter commented 9 years ago
Thanks for quick response!
Although your pickle example works fine after applying the patch, mysend.py 
still 
reports the same error.

Original comment by HaiZ...@gmail.com on 5 May 2010 at 7:17

GoogleCodeExporter commented 9 years ago
I should have tried the original code before declaring victory.  I can 
reproduce the
error, but I get a slightly different traceback than the original:

Traceback (most recent call last):
  File "/usr/lib/python2.6/multiprocessing/queues.py", line 242, in _feed
    send(obj)
TypeError: 'NoneType' object is not callable

Original comment by psobe...@gmail.com on 5 May 2010 at 5:18

GoogleCodeExporter commented 9 years ago
I think the difference is because of you have python2.6 and I python2.5. Do you 
have 
any clues on how to deal with it?

Original comment by HaiZ...@gmail.com on 6 May 2010 at 5:41

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r137.

Original comment by psobe...@gmail.com on 7 May 2010 at 5:50

GoogleCodeExporter commented 9 years ago
The victory has been accomplished!!! Many thanks!!

Original comment by HaiZ...@gmail.com on 12 May 2010 at 3:43