首页 > 解决方案 > 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.

标签: pythonmacosdirectorymkdir

解决方案


看起来您尝试使用的文件夹路径仅可用于读取,不可用于写入。尝试更改路径的设置。

看看这个:

https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac


推荐阅读