python - IsADirectoryError: [Errno 21] 是一个目录:
问题描述
我正在尝试在我的输出文件夹中写入一个新文件,但我不断收到错误消息“IsADirectoryError:[Errno 21] 是一个目录:'Output/'。
当我使用:
outputFile = os.path.join(outputFilePath, Path(inFilePath).stem + "-" + new )
它有效,但是,当我使用时它不起作用:
outputFile = outputFilePath
我特别尝试使用第二个,因为在我的主函数中我传入了 3 个参数(InputFilePath、OutputFilePath、Num)。我将在管道中调用“OutputFilePath”,因此它必须保留该名称。它适用于我以前编写的程序,所以我不知道为什么它现在不起作用。
解决方案
推荐阅读
- javascript - 在跳过数组中的第一个对象时从 API 获取数据
- c# - Blazor WASM 基于查询字符串授权属性
- string - lua拆分字符串并保存在lua表中
- sql - 尝试插入表时违反完整性约束错误
- python-3.x - 如何将自定义对象分配给 xarray 数据值?
- javascript - 在 React 中第一次使用 Axios 没有错误时进行第二次 api 调用
- java - 让冒泡排序更高效
- java - 使用 TNS 连接到外部 Oracle 数据库
- r - 用 NA 创建虚拟变量的更好方法-尝试改进编码我已经做得很差了
- python - 如何使用 tf.function 从 TensorFlow 中的一组函数中随机选择