Matlab unable to relaod the python module

3 ビュー (過去 30 日間)
Sahel Fallahdoust
Sahel Fallahdoust 2017 年 11 月 29 日
コメント済み: Swasti 2025 年 7 月 10 日
Hi,
I'm using Matlab R2016b with python 2.7. The first time that I made my python module within my Matlab project folder and tried to run it using py.mymod.myfunc it did work perfectly, but then I changed my python module and the next time I was running my matlab, it was giving me this error:
Undefined variable "py" or class "py.connection.getFromDB"
My Matlab code is:
function [status] = pipeMe()
[own_path , ~ ,~] = fileparts(mfilename('fullpath'));
module_path = fullfile(own_path, '..');
python_path = py.sys.path;
if count(python_path , module_path) == 0
insert (python_path , int32(0) , module_path);
end
final = py.connection.getFromDB();
end
I tried to use:
module = py.importlib.import_module('connection');
py.reaload(module);
but I got the same error. I highly appreciate it if you could help me with this issue. Thanks.
  1 件のコメント
Swasti
Swasti 2025 年 7 月 10 日
Is it possible that the issue is related to the mispelling of "py.reaload(module);" in the last line? It should instead be...
py.reload(module);

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by