Python--pycharm backup_ver1.py Console has been backup FAILED

Source: Internet
Author: User

1, Windows does not own the zip, need to install itself, http://gnuwin32.sourceforge.net/packages/zip.htm

2, after installation, to configure environment variables: PATH

3. backup_ver1.py Code in the Concise Python tutorial (A Byte of Python)

Import Osimport time#1, files and directories that need to be backed up will be specified in a list. #windows下source = [' "" C:\\My Documents "', ' C:\\code '] #这里要注意, we must enclose the string in double quotation marks, because there are spaces in the string. #2, the backup file must be stored in a primary backup directory under #windows target_dir = ' e:\\backup ' #3, the backup file will be packaged and compressed into a zip file. The name of the #4, Zip compressed file is comprised of the current date and time. target = Target_dir + os.sep +         time.strftime ('%y%m%d%h%m%s ') + '. zip ' #如果目标目录还不存在, then create if not os.path.exists (target_ DIR):    os.mkdir (Target_dir) #创建目录 # #, we are using the zip command to package the file in zip format Zip_command = ' zip-r {0} {1} '. Format (target, ". Join ( SOURCE)) #运行备份print (' Zip command is: ') print (zip_command) print (' Running: ') if Os.system (zip_command) = = 0:    print (' Successful backup to ', Target ' else:    print (' Backup FAILED ')

4, the first time the operation, the output of the Pycharm display Backup FAILED, and accompanied by garbled, as follows:

' Zip '???????????????????????? Keyboard????
?????????????
Backup FAILED

5, online check for a long time, some say do not use zip for WinRAR, 7-zip, some said Pycharm font display has the problem of de encoding set to GBK ... Wait, all have tried (this middle has not shut down pycharm restart), have no effect.

6, finally I bored, restart a pycharm, the result is good!

7, do not know what the reason, together pondering it! Ha ha...

8, there is a doubt: once I chose the way in the run "Run File in Console", the result has been shown, close the page, restart Pycharm no way to restore the original appearance, who knows how to do?

Python--pycharm backup_ver1.py Console has been backup FAILED

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.