-1
我为学校项目创建了一个.tiff图像生成器,它在我的电脑上运行得非常好!在FTP上保存创建的图像?
此生成器现在在ftp服务器上,它生成.tiff,并将其保存在ftp以便能够被下载。 但它不起作用。当用户点击指定的按钮“生成”时,我用函数php exec()或system()调用我的python脚本 你知道如何使用我的python脚本将我的img .tiff保存在ftp服务器上吗?
谢谢你的回答,对不起我的英文,我是法国人。
img = Image.fromarray(data, 'CMYK') #Make image from matrix
ftp = FTP('wbe-site', 'Identifiant', 'Password') #it's changed in my
code
etat = ftp.getwelcome()
print("Etat : ", etat)
f = open(img, 'rb') # Open the image
ftp.storbinary('STOR carte.tiff', f) #Save file on FTP
f.close() # Close the file
ftp.quit()
你好男人,看看我的代码,这是我做的:p – florian
你有ftplib导入吗?你还有什么错误? –
是FTPLIB是进口的;) 在这里你可以看到我的错误信息: 回溯(最近通话最后一个): 文件 “./generation.py”,行96,在 tiffEnCouleurs(fichier)\t \t \t \t #function使文件 文件 “./generation.py”,线86,在tiffEnCouleurs F =开放(IMG, 'RB')\t \t \t #opening文件.TIFF 类型错误:强迫为Unicode:需要字符串或缓冲区,找到图像 –
florian