pycall : unable to share/expose char array (Unexpected python type descriptor: U)
code example :
metadata:
pope_acronym_size: int
pope_acronym: { type: array, subtype: char, size: '$pope_acronym_size' }
plugins:
pycall:
on_event:
POPE_local_1fpp:
with:
exec: |
import numpy as np
acronym_size = 4
acronym = 'toto'
print(' * [debug] pope_acronym_size =',acronym_size)
print(' * [debug] pope_acronym =',acronym)
pdi.expose( 'pope_acronym_size' , acronym_size , pdi.OUT )
arr = list(acronym)
arr2 = np.array(arr)
print(' * [debug] arr =', arr)
print(' * [debug] arr2 =', arr2)
pdi.expose( 'pope_acronym' , arr2 , pdi.OUT )
I get this as output,
* [debug] pope_acronym_size = 4
* [debug] pope_acronym = toto
* [debug] arr = ['t', 'o', 't', 'o']
* [debug] arr2 = ['t' 'o' 't' 'o']
Exposing acronym, arr or arr2 (that are resp. string, list and numpy chararray) causes the same error : unable to interpret Unicode type :
*** [PDI/PyCall] Error: while calling python, caught exception: Error: Impl_error: Unexpected python type descriptor: U
At:
/usr/lib/python3/dist-packages/pdi/__init__.py(41): share
/usr/lib/python3/dist-packages/pdi/__init__.py(44): expose
<string>(24): <module>
I also tried bytes(arr, 'utf-8'), I get the same error with type descriptor: S ...