Page 1 of 1

Save process issue for ListOf(ReadDiskItem)

Posted: Thu Oct 23, 2008 1:14 pm
by souedet
Hello Yann,

I tried to save process parameters for the following simple test process that uses ListOf(ReadDiskItem) :

# ------------------------------------------------------------------------------------------------------------------------------------------
# Ligne obligatoire
from neuroProcesses import *

# Pour les formats de fichier Aims
import shfjGlobals

name = 'Tests'
userLevel = 2

signature = Signature(
'Input_ListOf_3dImage', ListOf( ReadDiskItem( '3D Volume', shfjGlobals.aimsVolumeFormats ) ),
)

def execution( self, context ):
for value in self.Input_ListOf_3dImage :
print value

# ------------------------------------------------------------------------------------------------------------------------------------------

The issue occurs in soma.minf.tree when I save the process parameters. No reducer seems to be found for the type neuroDiskItems.File and the following error is generated :

Traceback (most recent call last):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/brainvisa/neuroProcessesGUI.py", line 1434, in saveAs
event.save( minf )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/brainvisa/history.py", line 168, in save
writeMinf( eventFile, ( self, ), reducer=minfHistory )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/api.py", line 263, in writeMinf
writer.write( firstItem )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/xml_writer.py", line 98, in write
self._write( minfNodeIterator, minfNode, 0, '' )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/xml_writer.py", line 146, in _write
self._write( minfNodeIterator, Undefined, level+1, '' )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/xml_writer.py", line 142, in _write
self._write( minfNodeIterator, Undefined, level+1, minfNode )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/xml_writer.py", line 142, in _write
self._write( minfNodeIterator, Undefined, level+1, minfNode )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/xml_writer.py", line 142, in _write
self._write( minfNodeIterator, Undefined, level+1, minfNode )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/xml_writer.py", line 133, in _write
for minfNode in minfNodeIterator:
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 235, in reduce
for minfNode in typeReducer( self, o ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 189, in __call__
for minfNode in reducer.reduce( item ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 235, in reduce
for minfNode in typeReducer( self, o ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 263, in dictReducer
for minfNode in reducer.reduce( value ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 235, in reduce
for minfNode in typeReducer( self, o ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 263, in dictReducer
for minfNode in reducer.reduce( value ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 235, in reduce
for minfNode in typeReducer( self, o ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 263, in dictReducer
for minfNode in reducer.reduce( value ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 235, in reduce
for minfNode in typeReducer( self, o ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 249, in sequenceReducer
for minfNode in reducer.reduce( *sequence ):
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 234, in reduce
typeReducer = self.getTypeReducer( o.__class__ )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 220, in getTypeReducer
reducer = base.getTypeReducer( className )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 220, in getTypeReducer
reducer = base.getTypeReducer( className )
File "/i2bm/home/ns215310/Developments/p4/build-stable-Mandriva-2008.0-i686-debug/python/soma/minf/tree.py", line 223, in getTypeReducer
if issubclass( classOrName, HasSignature ):
TypeError: issubclass() arg 1 must be a class


The computer on which it was tested is configured as follow :
- Name : is205629
- OS : Mandriva 2008
- Version : stable
- Mode : debug

Nico

Re: Save process issue for ListOf(ReadDiskItem)

Posted: Thu Oct 23, 2008 3:45 pm
by souedet
Yann, I fixed this issue in perforce changelist 30950. Could you that the fix is OK for you ?

Re: Save process issue for ListOf(ReadDiskItem)

Posted: Fri Oct 24, 2008 9:32 am
by Yann Cointepas
Your change is Ok Nicolas. convertStateValue could have been a static method but I do not know how to implement recursive static method that could be overloaded in a derived class. With an instance method (or a class method) we keep the possibility redefine it in a subclass.