如何解决Raspbian中文本文件的“权限被拒绝”问题?

时间:2019-08-03 14:32:25

标签: linux raspberry-pi file-permissions raspbian

我已经使用TelegramBotAPI在python中编写了电报脚本。

即使在Windows或Ubuntu中,它也可以完美运行。但是Raspbian中存在一个问题。

其中一个命令仅使用简单的以下代码即可调用FTP文件并尝试写入文本文件。

def bajarftp (remote_file):
    ftp = FTP("example.com")  
    ftp.login(user='xxx', passwd=".........")   
    localfile = open("archivo.txt","wb")
    ftp.retrbinary('RETR '+ archivoremoto,localfile.write)
    ftp.quit()
    return 

这是从TelegramBot中调用的函数。

这可以在Windows或Ubuntu中使用,但在Raspbian中会发生以下错误

error "permission denied for archivo.txt".

我再次写了许可,但错误仍然出现

编辑:

Pi:

$ id; pwd; ls -ld
uid=1000(pi) gid=1000(pi) grupos=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),997(gpio),998(i2c),999(spi)
/home/pi/bot2
drwxrwxrwx 3 pi pi 4096 ago 3 12:34 .

Ubuntu:

$ id; pwd; ls -ld
uid=1000(jmanuelab) gid=1000(jmanuelab) grupos=1000(jmanuelab),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),118(lpadmin),129(sambashare)
/home/jmanuelab/bot_2
drwxr-xr-x 3 jmanuelab jmanuelab 4096 jul 31 20:17 .

0 个答案:

没有答案