- Open File Explorer and navigate to the Python installation directory, for example, C:\Users\username\AppData\Local\Programs\Python\Python39.
- Right-click on the Python folder and select "Properties."
- Go to the "Security" tab.
- Click "Edit," then "Add."
- Click "Advanced," and under "From this location," select your computer's hostname (you can find your hostname by typing hostname in the Command Prompt).
- Click "Find Now," locate, and select "MwWebAppWorkerR2024a" (or the appropriate account for your MATLAB version).
- Grant the necessary permissions to the Web App Server account to allow it to run your web application.
How to use Python on Webapp Server running on Windows?
6 次查看(过去 30 天)
显示 更早的评论
I have created predict.py and added to .ctf, In startup I have used following code
if isdeployed
pyenv(Version="C:\Users\MatlabWebAppVM\AppData\Local\Programs\Python\Python39");
[filepath,~,~] = fileparts(mfilename('fullpath'));
insert(py.sys.path, int64(0), filepath);
end
Getting this error while running on server
0 个评论
回答(1 个)
Rushikesh
2024-10-8
编辑:Rushikesh
2024-10-8
Hello,
I understand that you're trying to execute Python code within a MATLAB Web App by setting the 'pyenv' version in the 'startupFcn'. However, you're encountering a long loop that ends with a "Something went wrong" error. This error typically occurs when the MATLAB Web App Server is unable to access the Python installation directory.
The MATLAB Web App Worker account, named “MwWebAppWorkerR2024a” (replace with the appropriate version for your MATLAB installation), needs permission to access your Python executable directory.
Here's how you can set the necessary permissions on Windows:
I've attached a screenshot of the “Properties > Security > Edit > Add” window for clarity. For more detailed instructions on configuring the MATLAB Web App Server to use Python, you can refer to the below MATLAB Answer.
Hope this helps you.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Python Client Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!