python - FileNotFoundError: [WinError 3] 系统找不到指定的路径:'MP_Data\\hello'
问题描述
# Path for exported data, numpy arrays
DATA_PATH = os.path.join('MP_Data')
# Actions that we try to detect
actions = np.array(['hello', 'thanks', 'iloveyou'])
# Thirty videos worth of data
no_sequences = 30
# Videos are going to be 30 frames in length
sequence_length = 30
# Folder start
start_folder = 30
for action in actions:
dirmax = np.max(np.array(os.listdir(os.path.join(DATA_PATH, action))).astype(int))
for sequence in range(1,no_sequences+1):
try:
os.makedirs(os.path.join(DATA_PATH, action, str(dirmax+sequence)))
except:
pass
错误:
FileNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4900/2191428336.py in <module>
1 for action in actions:
----> 2 dirmax = np.max(np.array(os.listdir(os.path.join(DATA_PATH, action))).astype(int))
3 for sequence in range(1,no_sequences+1):
4 try:
5 os.makedirs(os.path.join(DATA_PATH, action, str(dirmax+sequence)))
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'MP_Data\\hello'
解决方案
得到了答案:
for action in actions:
for sequence in range(no_sequences):
try:
os.makedirs(os.path.join(DATA_PATH, action, str(sequence)))
except:
pass
推荐阅读
- css - 我可以使用 CSS 兄弟选择来选择带有链接的标签,该链接跟在带有图像的标签之后吗?
- avaudioplayer - 如何使用 AVAudioPCMBuffer 寻找逻辑 AVAudioEngine
- python - 给定一维梯度形式的向量,如何通过一个轴调整图像大小?
- ruby - Ruby 有没有办法阻止用户在访问不同的函数/过程之前通过 case 调用函数/过程?
- c++ - 为什么当一个函数接受一个指针时,我们传递一个特定变量的地址,而不是一个指针?
- firebase - GoogleAuthProvider 在 Stackblitz 项目中工作,但在部署到 Firebase 托管时抛出 Unexpected Identifier
- asp.net-core - 来自 Rotativa.AspNetCore 的未处理异常
- ios - 覆盖项目和第三方的 NSLog
- reactjs - 单击按钮时未按预期过滤数组
- angular - Angular MatTable 不会使用来自表单的数据进行更新