我在 Debian 服务器中安装了rclone软件包,并且可以正常工作。
rclone ls mygdrive:mypath
现在,我想在我的python脚本中使用rclone所以我安装了python-rclone
pip 安装 python-rclone
但是我如何将其配置为使用主配置文件/root/.rclone.conf或任何其他解决方案?
尝试这个。
import rclone
cfg_path = r'/root/.rclone.conf'
with open(cfg_path) as f:
cfg = f.read()
result = rclone.with_config(cfg).listremotes()
Run Code Online (Sandbox Code Playgroud)
with_config期望cfg为字符串。看看这里的例子 - https://github.com/ddragosd/python-rclone#usage