I'm learning python, wrote an example from a book on creating backup, only instead of using gnu32win I used winRAR for archiving the code:
import os import time # files and directories to add to the list sourse = ['c:\\backup\\'] print('Create ', len(sourse), ' backup') # backup storage directory target_dir = ('D:\\backup') print('backup storage directory') # archiv name format target = target_dir + os.sep + time.strftime('%Y.%m.%d_') + '.rar' print('archiv name format') rar = "'C:\Program_Files\WinRAR\WinRAR.exe u -as -dh {0} {1}'".format(target, "".join(sourse)) if os.system(rar) == 0: print('backup ok') else: print('backup error')
I use IDE PyCharm, in the console I get the following error:
'Create 1 backup backup storage directory archiv name format ⥬ 㤠 㪠 . backup error'
In pycharm is the utf-8 encoding, tell me what could be the problem?
C:\Program_Files\WinRAR\WinRAR.exe
->C:\\Program_Files\\WinRAR\\WinRAR.exe
. Also, are you sure that your folder is calledProgram_Files
and notProgram Files
(space instead of underscore)? - ankhzet