python - Problem with os.makedirs() function with Python3 on Mac OS Catalina
问题描述
I'm having some trouble getting the os.makedirs() function to work. I'm currently experimenting in IDLE's shell right now and this is the error I'm getting when trying to use this function:
os.makedirs('/delicious\walnut\waffles')
Error:
Traceback (most recent call last):
File "<pyshell#48>", line 1, in <module>
os.makedirs('/delicious\walnut\waffles')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/delicious\\walnut\\waffles'
Im just trying to create a random new directory. I'm going through this book called "Automate the Boring Stuff" and I'm doing this as part of Chapter 8.
解决方案
看起来您尝试使用的文件夹路径仅可用于读取,不可用于写入。尝试更改路径的设置。
看看这个:
https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac
推荐阅读
- visual-studio - Visual Studio 2017 中不存在要启动的 D 程序
- linux - 如何在docker的RUN命令中执行两个命令?
- python - 根据其他列值标记行
- android - 设置 WhatsApp 贴纸的应用程序有问题
- c++ - 使用 Ardunio 从 RFID 卡中检索信息
- javascript - 为什么在 react js 制作日期选择器中没有导入 css?
- r - R:了解省略号 (...) 如何在嵌套函数中工作,以及它如何不工作
- c - C:交换两个指针值
- scala - Type information for primitive types in polymorphic types
- ios - 反应本机iOS:无法连接到开发服务器