How can I import python module properly instead of namespace package

12 次查看(过去 30 天)
I'm trying to import python module asammdf with:
py.importlib.import_module('asammdf');
it gives me the following:
'<module 'asammdf' (namespace)>'
but the:
'<module 'asammdf' from 'C:\\Program Files\\Python38\\lib\\site-packages\\asammdf\\__init__.py'>'
was expected.
Once I try using the library with:
MDF = py.asammdf.MDF();
I will recieve:
Unable to resolve the name py.asammdf.MDF
Any thouights how can i solve it?
* I already reinstalled python and checked the same lib on python cosole - it works there.

回答(1 个)

Al Danial
Al Danial 2022-9-16
Try assigning the import to a variable:
asammdf = py.importlib.import_module('asammdf');
then
MDF = asammdf.MDF();
  4 个评论
Eros
Eros 2024-9-3
Hello @Al Danial,
with this command the output is only MFD.start_time, nothing else.
What am I doing wrong?
Also, having chosen the MF4 file, how can I associate the DBC with it?
Thanks
Al Danial
Al Danial 2024-9-4
I know almost nothing about asmmdf or its MDF function. Best get that information from the MDF documentation or sources other than this forum.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by