什么可能通过启动而不是交互导致 python 权限问题?

问题描述

我在我的 MacBook Pro 上设置了 launchd 来重复运行 python 脚本。它通过 /Library/launchdaemons 中的 plist 文件以 root 身份运行。脚本中麻烦的一行是

result.to_csv(FilePath+HQuotes,index=False)

出现以下错误

    Traceback (most recent call last):
  File "/Users/nicholaskalita/PycharmProjects/CrpytoScrape/CMCScrape.py",line 253,in <module>
    dframe.to_csv(FilePath+NQuotes,index=False)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/generic.py",line 3387,in to_csv
    return DataFrameRenderer(formatter).to_csv(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/io/formats/format.py",line 1083,in to_csv
    csv_formatter.save()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/io/formats/csvs.py",line 228,in save
    with get_handle(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/io/common.py",line 642,in get_handle
    handle = open(
PermissionError: [Errno 1] Operation not permitted: '/usr/local/mnt/KalitaSRV03/home/documents/LifeAndwork/Dosh/Invest/Crypto/CryptoLatestQuotes.csv'

该路径位于网络驱动器上。以交互方式运行脚本,无论是否具有 root 权限,都可以正常工作。目标文件权限是

-rwxrwxrwx@ 1 nicholaskalita  wheel   34753 25 May 17:30 CryptoLatestQuotes.csv

将目标文件移动到 MacBook 上的本地磁盘没有任何改变。任何人都可以提出解决此问题的方法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)