[mayavi] how to copy/duplicate modules/filters?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[mayavi] how to copy/duplicate modules/filters?

fred-2
Hi all,

In the following CME, I would like to copy the DataSetClipper filter (dsc2).

For that purpose, I use copy() from copy, but this raises an exception

/usr/local/lib/python2.6/dist-packages/AppTools-3.4.1.dev_r25953-py2.6.egg/enthought/persistence/state_pickler.py:197:
DeprecationWarning: objec                       t.__init__() takes no
parameters
   tuple.__init__(self, seq)
ERROR|2010-12-14 17:12:22,476|Exception
Traceback (most recent call last):
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/source.py",
line 216, in _ha                       ndle_children
     obj.start()
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/filter.py",
line 111, in sta                       rt
     super(Filter, self).start()
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/source.py",
line 128, in sta                       rt
     super(Source, self).start()
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/pipeline_base.py",
line 94,                        in start
     super(PipelineBase, self).start()
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/base.py",
line 198, in start
     self._load_saved_state()
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/base.py",
line 417, in _load                       _saved_state
     self.__set_pure_state__(state)
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/filters/data_set_clipper.py",
lin                       e 88, in __set_pure_state__
     super(DataSetClipper, self).__set_pure_state__(state)
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26011-py2.6-linux-x86_64.egg/enthought/mayavi/core/source.py",
line 67, in __se                       t_pure_state__
     set_state(self, state, ignore=['children'])
   File
"/usr/local/lib/python2.6/dist-packages/AppTools-3.4.1.dev_r25953-py2.6.egg/enthought/persistence/state_pickler.py",
line 955, in set_sta                       te
     StateSetter().set(obj, state, ignore, first, last)
   File
"/usr/local/lib/python2.6/dist-packages/AppTools-3.4.1.dev_r25953-py2.6.egg/enthought/persistence/state_pickler.py",
line 745, in set
     self._do(obj, key, state[key])
   File
"/usr/local/lib/python2.6/dist-packages/AppTools-3.4.1.dev_r25953-py2.6.egg/enthought/persistence/state_pickler.py",
line 826, in _do
     self._do_object(getattr(obj, key), value)
   File
"/usr/local/lib/python2.6/dist-packages/AppTools-3.4.1.dev_r25953-py2.6.egg/enthought/persistence/state_pickler.py",
line 831, in _do_obj                       ect
     self.type_map[state.__class__](obj, state)
   File
"/usr/local/lib/python2.6/dist-packages/AppTools-3.4.1.dev_r25953-py2.6.egg/enthought/persistence/state_pickler.py",
line 880, in _do_dic                       t
     self._do_object(obj[key], value)
KeyError: 'update_mode_'

So: is copy() the right function to use to do that? Is it a bug somewhere?

What should I use, or what is the right way to copy/duplicate modules &
filters?

This issue is very general, ie I get a tons of issues like this one
(and these issues are very annoying) when I want to copy a module or a
filter in my code.

Any clue?

TIA

Cheers,

--
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

cme8.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi] how to copy/duplicate modules/filters?

Gael Varoquaux
On Tue, Dec 14, 2010 at 05:23:50PM +0100, Fred wrote:
> So: is copy() the right function to use to do that? Is it a bug somewhere?
>
> What should I use, or what is the right way to copy/duplicate modules &  
> filters?
>
> This issue is very general, ie I get a tons of issues like this one
> (and these issues are very annoying) when I want to copy a module or a  
> filter in my code.

Yes, the issue is quite general: persisting and resuming a graph of
object that interplay is an non trivial operation, as you need to express
the order in which the peristence, or the recreation, operation needs to
be done. Python does not offer a way to do this and Prabhu and Dave
Peterson had for a while thought about writing a PEP on this. However, it
was too much work, and it never got anywhere.

If you want to work on it, feel free.

Another lead to investigate would be to check out how copy/pasting works
in the Engine tree. You should be able to figure it out by looking at the
Mayavi source code, thought it might not solve your problem. I had a
quick look but I could not find something quickly.

My eyes are burning from jet lag and too much time staring at a computer
screen. I can't afford spending time on this, sorry.

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi] how to copy/duplicate modules/filters?

Gael Varoquaux
On Tue, Dec 14, 2010 at 05:33:03PM +0100, Gael Varoquaux wrote:
> On Tue, Dec 14, 2010 at 05:23:50PM +0100, Fred wrote:
> > So: is copy() the right function to use to do that? Is it a bug somewhere?

> > What should I use, or what is the right way to copy/duplicate modules &  
> > filters?

> > This issue is very general, ie I get a tons of issues like this one
> > (and these issues are very annoying) when I want to copy a module or a  
> > filter in my code.

> Yes, the issue is quite general: persisting and resuming a graph of
> object that interplay is an non trivial operation, as you need to express
> the order in which the peristence, or the recreation, operation needs to
> be done. Python does not offer a way to do this and Prabhu and Dave
> Peterson had for a while thought about writing a PEP on this. However, it
> was too much work, and it never got anywhere.

Also, you could try pickle/unpickle, thought it might fail in the same
way.

G
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi] how to copy/duplicate modules/filters?

fred-2
In reply to this post by Gael Varoquaux
Le 14/12/2010 17:33, Gael Varoquaux a écrit :

> Another lead to investigate would be to check out how copy/pasting works
> in the Engine tree. You should be able to figure it out by looking at the
> Mayavi source code, thought it might not solve your problem. I had a
> quick look but I could not find something quickly.
I already thought about this, but the same here, helpless (for me).

Thanks anyway for your answer, Gaël.


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev