필터 지우기
필터 지우기

Error message concerning path

조회 수: 12 (최근 30일)
Reuben Addison
Reuben Addison 2023년 3월 22일
답변: Nithin Kumar 2023년 4월 1일
I am trying to make a loop over several folders using a path for my function but when I test the code I get
subject_number = "45";
maindir = sprintf('/Users/Baso/Desktop/TMM/TMM%s/m2m_TMM%s', subject_number,subject_number);
part = sprintf('/TMM%s_tms_PH_simu', subject_number);
S.subpath = maindir;
S.subpath = fullfile(maindir, part);
I keep getting the error "TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType"
  댓글 수: 3
Nithin Kumar
Nithin Kumar 2023년 3월 31일
편집: Nithin Kumar 2023년 3월 31일
Hi Reuben,
I have executed the code that you have provided and it is working fine. I would like to know more details regarding the issue you are facing.
Stephen23
Stephen23 2023년 3월 31일
편집: Stephen23 2023년 3월 31일
That is a Python error: it refers to Python's inbuilt "os" module:
and to Python's object type "NoneType":
You should be asking on a Python forum.

댓글을 달려면 로그인하십시오.

답변 (1개)

Nithin Kumar
Nithin Kumar 2023년 4월 1일
Hi Reuben,
I understand that you are facing an issue while trying to loop over several folders using a path. The error message "Typeerror: stat: path should be string, bytes, os.pathlike or integer, not NoneType" occurs when you are trying to perform a file operation and the path that you have provided is not a valid path.
To resolve this error, you should check that the path you are providing is a valid file path. You can use the "exist" function to check if a file or folder exists. Kindly refer to the following link to go through the "exist" function.
You should also make sure that the path is formatted correctly and that you are using the correct file extension.
I hope this answer resolves the issue you are encountering.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by