integrate pyton script in a standalone Matlab app

i'm trying to develop a standalone matlab app but with some python script in it. when i run the code in app designer, it works fine but when i compile the standalone app, it doesn't work. when packaging I include the python script and the python folder (oct_converter) which it's necessary and also the init.py and the package looks fine I guess. I also commented the lines where I called python and develop another standalone app and it worked so I think it's definitely the use of python script. also since it's the standalone app, it doesn't show me any erorr message it just crashes
I'm running matlab R2020b on macOS

6 commentaires

You can find the cause by enabling a log file.
Could you try checking the "Create log file" option in "Additional runtime settings"?
I had a similar problem, my python code couldn't find python.
I included
pe = pyenv
in the startup programm and it did the trick.
when you say in the startup program do you mean the app designer ?
Eric Delgado
Eric Delgado le 15 Juil 2021
Modifié(e) : Eric Delgado le 15 Juil 2021
Do you know how to configure correctily pyenv in a client computer with more than one Python versions (and no Matlab)? Or how to deal with a MatlabRunTimer that did'n find a Python executable?
Should a create another app just to configure pyenv?
@frederic tchuisseu Yes the startup program of the app designer. That runs everytime you launch the app, therefore you make sure that python is always found.
@Eric Delgado I downloaded Anaconda on my computer and installed it for "all users". With the command
pe = pyenv
the python version is found, and it works only if Anaconda was installed for all users.
I didn't include any separate python scripts as you did but I used some python functions instead.
When you export your standalone programm, make sure the end user has installed Anaconda aswell for "all users" on their computer. With the startup programm searching for the actual python version should everthing work as desired.
Let me know if this helped you.
James Nesson
James Nesson le 1 Avr 2022
Modifié(e) : James Nesson le 1 Avr 2022
i have this in the startup call back and it runs with no alert.
%check if python is installed
pe = pyenv;
if isempty(pe.Version)
fig = uifigure;
uialert(fig,'Please install Python and XlsxWriter',['Python' ...
' is not installed']);
end
but when my code gets to my pyrunfile command it does not work.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by