在raspberry pi上运行dropbox uploader脚本时,无法创建目录错误

问题描述 投票:0回答:1

我正在创建一个python脚本,可以自动将图像从usb stick上传到dropbox。当您点击Pin 29上的按钮时会激活。当我在终端中运行dropbox_uploader(https://www.raspberrypi.org/magpi/dropbox-raspberry-pi/)时,它工作正常,但是当我将其翻译为python时,它无法创建新目录。

我已经尝试找到解决os.system()的问题,因为我觉得这是问题,但到目前为止还没有任何工作。

from time import sleep
import os
import RPi.GPIO as GPIO


GPIO.setmode(GPIO.BOARD)
button=29
GPIO.setup(button,GPIO.IN,pull_up_down=GPIO.PUD_UP)

command = 'Dropbox-Uploader/dropbox_uploader.sh upload /media/pi/TOSHIBA_EXT/TESTBOX X'

while(1):
    if GPIO.input(button)==0:
        print "Button pressed and starting upload"
        os.system(command)

点击一个按钮,脚本就会运行。将图像发送到Dropbox。

python-3.x raspberry-pi3 dropbox
1个回答
0
投票

好!嗯...我尝试了不同的wifi网络上的代码...它的工作原理......不确定原因,但是耶! :)

© www.soinside.com 2019 - 2024. All rights reserved.