The problem triggers here,
File "prueba6.py", line 51, in on_key_release
    self.sprite.do(SetImage(spritetoleft))


Action's parameters must be deepcopiable.
A comon workaround is to
 - store the no deepcopiable params in the node, like
     node.my_param = ...
 - In the action .start method use target.my_param to acces the desired
param



On Sun, Oct 15, 2017 at 10:27 AM, Alan Etkin <[email protected]> wrote:

> Hi
>
> I've created a simple instantaction class for assigning an image (pyglet
> resource) to a sprite, but I get an exception about pickled objects.
> Perhaps someone here can explain what is wrong. A search on the docs did
> not return any info on this issue. I attach a minimal example.
>
> Here is the error traceback
>
> Thanks
>
> Traceback (most recent call last):
>   File "prueba6.py", line 63, in <module>
>     cocos.director.director.run(main_scene)
>   File "/usr/local/lib/python3.5/dist-packages/cocos/director.py", line
> 406, in run
>     event_loop.run()
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/app/base.py", line
> 136, in run
>     self._run_estimated()
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/app/base.py", line
> 175, in _run_estimated
>     if not platform_event_loop.step(estimate) and estimate != 0.0 and \
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/app/xlib.py", line
> 124, in step
>     device.select()
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/canvas/xlib.py",
> line 165, in select
>     dispatch(e)
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/window/
> xlib/__init__.py", line 900, in dispatch_platform_event_view
>     event_handler(e)
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/window/
> xlib/__init__.py", line 1079, in _event_key_view
>     self.dispatch_event('on_key_release', symbol, modifiers)
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/window/__init__.py",
> line 1154, in dispatch_event
>     if EventDispatcher.dispatch_event(self, *args) != False:
>   File "/usr/local/lib/python3.5/dist-packages/pyglet/event.py", line 355,
> in dispatch_event
>     if handler(*args):
>   File "prueba6.py", line 51, in on_key_release
>     self.sprite.do(SetImage(spritetoleft))
>   File "/usr/local/lib/python3.5/dist-packages/cocos/cocosnode.py", line
> 778, in do
>     a = copy.deepcopy(action)
>   File "/usr/lib/python3.5/copy.py", line 182, in deepcopy
>     y = _reconstruct(x, rv, 1, memo)
>   File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct
>     state = deepcopy(state, memo)
>   File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict
>     y[deepcopy(key, memo)] = deepcopy(value, memo)
>   File "/usr/lib/python3.5/copy.py", line 182, in deepcopy
>     y = _reconstruct(x, rv, 1, memo)
>   File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct
>     state = deepcopy(state, memo)
>   File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict
>     y[deepcopy(key, memo)] = deepcopy(value, memo)
>   File "/usr/lib/python3.5/copy.py", line 182, in deepcopy
>     y = _reconstruct(x, rv, 1, memo)
>   File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct
>     state = deepcopy(state, memo)
>   File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict
>     y[deepcopy(key, memo)] = deepcopy(value, memo)
>   File "/usr/lib/python3.5/copy.py", line 174, in deepcopy
>     rv = reductor(4)
> ValueError: ctypes objects containing pointers cannot be pickled
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "cocos2d discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/cocos-discuss.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to