Linux rclone copy cmd from python script or php fails, - can't open rclone or failed to load rclone conf file

Hello every one and sorry if i am asking as noob question, i have installed rclone on my raspberry pi which is running Debian, i have successfully ran the cmd in the shell to backup a folder to google drive but i really need to be able to do so each time a take a photo with my python script, i have little experience in Linux compared to others and i thought that if i made a shell script with a basic shebang of
" #!/bin/sh or #!/bin/bash
rclone copy /var/www/html/camera_images pictures::folder1 "
which i made executable, this works if i just click it and execute but if i try to call that .sh script from python with
os.system(β€˜sh /home/pi/py/’) or os.system(’ rclone copy /var/www/html/camera_images pictures::folder1 β€˜)
i get an error in the shell saying Failed to load config file β€œ/root/.rclone.conf” using default - no such directory but the .conf is located in /home/pi as it should be.
and if i try os.system(’ sh rclone copy /var/www/html/camera_images pictures::folder1 ') i get sh: 0: Cant open rclone.

I read on one site about a cmd like --config=Config is that the answer if so how would i use it ?

Please can any one help me, i would like to now how i can run the copy cmd or a script to do so from python, Thank you and merry Christmas :slight_smile:
From Edwin


s.system(’ rclone copy --config /home/pi/.rclone.conf /var/www/html/camera_images pictures::folder1 ')

Glad you got it working.

I would do this using the subprocess module which is a better way of starting off subprocesses in python in general.

subprocess.check_call("rclone", "copy", "--config", "/home/pi/.rclone.conf /var/www/html/camera_images", "pictures:folder1")
1 Like