Problema:
Ao tentar importar o código Python gerado do seu projeto erpc usando ex.
from erpc_myproject import *Você vê a seguinte mensagem de erro:
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/.Solução
Ou você não instalou a biblioteca Python erpc (se a mensagem de erro listar ... different to the rest of eRPC code ('unknown')) ou você instalou a versão errada (ex. ... (1.9.1) is different to the rest of eRPC code ('1.10.0')).
Se você não instalou erpc de forma alguma, simplesmente use
pip install erpce tente novamente executar seu script.
Se você instalou a versão errada, você tem duas opções:
Opção 1 (preferida): Regenere o código
Basta usar o comando original (alguma chamada erpcgen) que você usou para regenerar o código usando a versão atualmente instalada.
Opção 2: Instale a versão correta
Para isso, você precisa determinar qual é a versão correta. Vamos considerar a seguinte mensagem de erro:
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/.Desta mensagem, podemos ler que a versão do código shim é 1.9.1 enquanto você tem 1.10.0 instalado. Portanto, para fazê-lo funcionar, precisamos instalar a versão 1.9.1 do erpc.
Instale-o usando
pip install -U erpc==1.9.1e então tente novamente seu comando. Se você está usando jupyter notebooks ou similar, você precisa reiniciar seu kernel para carregar a nova biblioteca!