I made this changes considering your first suggestion but I till get the warning
"
[WARNING] [MTD ] Unable to open device "/dev/input/event3". Please ensure you have the appropriate permissions.
" .
Unable to copy file. [Errno 21] Is a directory: '/home/purushottam2/Pictures'
printed in terminal .
from plyer import storagepath
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivy.uix.image import Image as KVImage
from kivy.core.image import Image
from os import path
import os
import shutil
from shutil import copyfile
from sys import exit
class SITApp(App):
source = str(storagepath.get_pictures_dir())
target = 'photo-1503023345310-bd7c1de61c7d.jpeg'
def build(self):
return Button(text="save", on_press=self.save)
def save(self, button):
#assert not os.path.isabs(source)
self.target = os.path.join(self.target, os.path.dirname(self.source))
# create the folders if not already exists
#os.makedirs(target)
# adding exception handling
try:
copyfile(self.source, self.target)
except IOError as e:
print("Unable to copy file. %s" % e)
except:
print("Unexpected error:", sys.exc_info())
# try:
# Image('download (1)0.jpg').save( str(storagepath.get_pictures_dir()) + 'download (1)0.jpg' )
# except Exception as e:
# button.text = str(e)
SITApp().run()