Closed Accelerox closed 1 year ago
What is the version of MATLAB and Python you are currently using?
I have tested running a .m file with a path containing non-UTF8 characters, and have found that everything worked fine with MATLAB 2023a and Python 3.9.
Sure thing! I conducted two more tests with different settings and got one of them to work. The above test was done with the settings
Python 3.10.9
Second test displaying the same issue on Linux (I have sneeked in a Ö after Sensor Fusion Folder)
(base) max@ubuntu:TSRT14-Lab2 $ /usr/local/bin/matlab -nodesktop -nosplash
< M A T L A B (R) >
Copyright 1984-2023 The MathWorks, Inc.
R2023a Update 1 (9.14.0.2239454) 64-bit (glnxa64)
March 30, 2023
Warning: X does not support locale en_US.UTF-8
To get started, type doc.
For product information, visit www.mathworks.com.
f>> printf('Working directory: %s\n', pwd);
Working directory: /home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor FusionÖ/TSRT14-Lab2
>> run('/home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor Fusion/TSRT14-Lab2/test.m')
Error using run
/home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor Fusion/TSRT14-Lab2/test.m not found.
>>
Doing a third test with Ubuntu and pybackend enabled (wiith a "ö" in path after "Sensor Fusion")
python /home/max/.vscode/extensions/shinyypig.matlab-in-vscode-0.3.2/pybackend/matlab_engine.py --cmd="""fprintf('Working directory: %s\n', pwd);"""
(base) max@ubuntu:TSRT14-Lab2 $ python /home/max/.vscode/extensions/shinyypig.matlab-in-vscode-0.3.2/pybackend/matlab_engine.py --cmd="""fprintf('Working directory: %s\n', pwd);"""
---------------------------------------------------------
MATLAB Engine for Python is ready (terminate with 'quit')
---------------------------------------------------------
Working directory: /home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor Fusion/TSRT14-Lab2
>>> run('/home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor FusionÖ/TSRT14-Lab2/test.m')
z =
10
>>>
Please let me know if there is any more tests I can do to help with this extension.
It seems to be a issue with matlab.
(base) max@ubuntu:TSRT14-Lab2 $ /usr/local/bin/matlab -nodesktop -nosplash
< M A T L A B (R) >
Copyright 1984-2023 The MathWorks, Inc.
R2023a Update 1 (9.14.0.2239454) 64-bit (glnxa64)
March 30, 2023
Warning: X does not support locale en_US.UTF-8
Can files with non-UTF-8 characters in their paths be run directly from the Matlab command line?
Yeah, the command
run('/home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor FusionÖ/TSRT14-Lab2/test.m')
with the Ö works fine from within the program matlab command prompt, and from within the matlab terminal opened by the extension in vscode.
Correct me if im'm wrong. butt since the extension is "building" the run command (without the ö) it should be the extension having problem with the char? As we can see from test 2: The run command is wrongly built, which gets generated from pressing the "run" button from within vscode.
>>> run('/home/max/Nextcloud/Utbildning/Universitet/4_e aret/TSRT14 - Sensor Fusion/TSRT14-Lab2/test.m')
However, I agree that the error message regarding locale support is weird, however Mathworks says it should have no functionality changes https://www.mathworks.com/matlabcentral/answers/1925710-warning-x-does-not-support-locale-en_us-utf-8
EDIT: It works only if im using the python matlab engine, swapping back to without it, the problem seems to be that I can't paste the command in to the terminal - so it seems you are right, the matlab terminal ommits the Ö without the python engine.
First of all, using non UTF8 characters in paths is bad practice, however, I'm in a position where I cant change the paths since they are determined by my University. With that said...
Having a non UTF8 characters in the path won't work when pressing the "Run current matlab file" in vscode. However, running current cell works fine.
Pressing run file yields:
The "ö" in the path has disappeared on closer inspection, real path is equal to