fork download
  1. # backup-zipfile.py
  2. print()
  3. # help('zipfile')
  4.  
  5. import zipfile
  6. import time
  7.  
  8. src = '/home/ahnas/Изображения/Dad of boy.jpg'
  9. # src = '/home/ahnas/Изображения/'
  10. # Надо указывать конкретный файл, каталоги не архивируются.
  11.  
  12. now = time.strftime('Archive-%H:%M:%S')
  13. # Имя архива.
  14.  
  15. print('Start...')
  16. with zipfile.ZipFile(now, mode='a') as zipF:
  17. zipF.write(src)
  18. print('Done.')
  19. zipF.close()
  20. print('End.')
Runtime error #stdin #stdout #stderr 0.15s 23220KB
stdin
Standard input is empty
stdout
Start...
stderr
Traceback (most recent call last):
  File "./prog.py", line 16, in <module>
  File "/usr/lib/python3.7/zipfile.py", line 1204, in __init__
    self.fp = io.open(file, filemode)
PermissionError: [Errno 13] Permission denied: 'Archive-13:50:04'