Problema:
Al intentar importar el código Python generado por tu proyecto erpc usando p. ej.
from erpc_myproject import *Ves el siguiente mensaje de error:
Traceback (most recent call last)
Cell In [1], line 1
----> 1 from erpc_myproject import *
File ./erpc_myproject/__init__.py:13
11 version = "unknown"
12 if version != "1.9.1":
---> 13 raise ValueError("The generated shim code version (1.9.1) is different to the rest of eRPC code (%s). \
14 Install newer version by running \"python setup.py install\" in folder erpc/erpc_python/." % repr(version))
16 from . import common
17 from . import client
ValueError: The generated shim code version (1.9.1) is different to the rest of eRPC code ('unknown'). Install newer version by running "python setup.py install" in folder erpc/erpc_python/.Solución
O bien no has instalado la librería de Python erpc (si el mensaje de error lista ... different to the rest of eRPC code ('unknown')) o has instalado la versión incorrecta (p. ej. ... (1.9.1) is different to the rest of eRPC code ('1.10.0')).
Si no has instalado erpc en absoluto, simplemente usa
pip install erpcy reintenta ejecutar tu script.
Si has instalado la versión incorrecta, tienes dos opciones:
Opción 1 (preferida): Regenerar el código
Solo usa el comando original (alguna llamada a erpcgen) que has usado para regenerar el código usando la versión instalada actualmente.
Opción 2: Instalar la versión correcta
Para esto, necesitas determinar cuál es la versión correcta. Consideremos el siguiente mensaje de error:
ValueError: The generated shim code version (1.9.1) is different to the rest of eRPC code ('1.10.0'). Install newer version by running "python setup.py install" in folder erpc/erpc_python/.De este mensaje, podemos leer que la versión del código shim es 1.9.1 mientras que tienes 1.10.0 instalado. Por lo tanto, para que funcione, necesitamos instalar la versión 1.9.1 de erpc.
Instálalo usando
pip install -U erpc==1.9.1y luego reintenta tu comando. Si estás usando jupyter notebooks o similar, necesitas reiniciar tu kernel para cargar la nueva librería!