2006年02月23日 星期四 16:51
import os import time source = [r'e:\temp\code',r'e:\temp\domains'] target_dir = r'e:\temp\bak' target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar' rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source)) print rar_cmd if os.system(r'cd D:\Program Files\WinRAR') == 0: if os.system(rar_cmd) == 0: print 'Successful backup to',target else: print 'Backup Failed!' else: print 'FAILED!!!' 'rar' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains Backup Failed! 但是在cmd命令行执行rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains 是可以成功的,这是为什么?? 礼! 致 礼! Cn.popeye cn-poper at 126.com 2006-02-23
2006年02月23日 星期四 16:53
RAR不是PYTHON内置的命令,要用的话,可以用系统安装路径来使用. 看这篇 http://3rgb.com/b/?act=viewthread&threadid;=451 在06-2-23,Cn.popeye <cn-poper at 126.com> 写道: > > import os > import time > source = [r'e:\temp\code',r'e:\temp\domains'] > target_dir = r'e:\temp\bak' > target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar' > rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source)) > print rar_cmd > if os.system(r'cd D:\Program Files\WinRAR') == 0: > if os.system(rar_cmd) == 0: > print 'Successful backup to',target > else: > print 'Backup Failed!' > else: > print 'FAILED!!!' > > 'rar' 不是内部或外部命令,也不是可运行的程序 > 或批处理文件。 > rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains > Backup Failed! > > > 但是在cmd命令行执行rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code > e:\temp\domains > 是可以成功的,这是为什么?? > 礼! > > > > 致 > 礼! > > > Cn.popeye > cn-poper at 126.com > 2006-02-23 > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060223/29f5ca85/attachment.htm
2006年02月23日 星期四 17:31
看简明的时候遇到的问题吧 http://post.baidu.com/f?kz=70662074 估计这个对你有帮助 On 2/23/06, Qi Ivan <qihboy at gmail.com> wrote: > > RAR不是PYTHON内置的命令,要用的话,可以用系统安装路径来使用. > 看这篇 > http://3rgb.com/b/?act=viewthread&threadid;=451 > > 在06-2-23,Cn.popeye <cn-poper at 126.com> 写道: > > > > import os > > import time > > source = [r'e:\temp\code',r'e:\temp\domains'] > > target_dir = r'e:\temp\bak' > > target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar' > > rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source)) > > print rar_cmd > > if os.system(r'cd D:\Program Files\WinRAR') == 0: > > if os.system(rar_cmd) == 0: > > print 'Successful backup to',target > > else: > > print 'Backup Failed!' > > else: > > print 'FAILED!!!' > > > > 'rar' 不是内部或外部命令,也不是可运行的程序 > > 或批处理文件。 > > rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains > > Backup Failed! > > > > > > 但是在cmd命令行执行rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code > > e:\temp\domains > > 是可以成功的,这是为什么?? > > 礼! > > > > > > > > 致 > > 礼! > > > > > > Cn.popeye > > cn-poper at 126.com > > 2006-02-23 > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- Andelf BLOG:http://blog.sohu.com/members/andelf/ BLOG:http://spaces.msn.com/members/andelf -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060223/36138f44/attachment-0001.html
2006年02月23日 星期四 17:34
我在测试limudo的diango教程时,MS-DOS下解压的话,你需要进入winrar的安装目录,然后才能使用rar命令。 这里不是很相关。 给你参考。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060223/0b61584e/attachment.html
2006年02月24日 星期五 11:21
Andelf£¬ÄúºÃ£¡ import os import time source = [r'e:\temp\code',r'e:\temp\domains'] target_dir = r'e:\temp\bak' target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar' rar_cmd = "D:\\Progra~1\\WinRAR\\rar.exe a -idcdp %s %s" % (target,' '.join(source)) print rar_cmd if os.system(rar_cmd) == 0: print 'Successful backup to',target else: print 'Backup Failed!' ¾ÍÊÇ·¾¶ÎÊÌâ.лл... ======== 2006-02-24 03:16:43 ÄúÔÚÀ´ÐÅÖÐдµÀ£º ======== ¿´¼òÃ÷µÄʱºòÓöµ½µÄÎÊÌâ°É http://post.baidu.com/f?kz=70662074 ¹À¼ÆÕâ¸ö¶ÔÄãÓаïÖú On 2/23/06, Qi Ivan <qihboy at gmail.com> wrote: RAR²»ÊÇPYTHONÄÚÖõÄÃüÁî,ÒªÓõĻ°,¿ÉÒÔÓÃϵͳ°²×°Â·¾¶À´Ê¹ÓÃ. ¿´Õâƪ http://3rgb.com/b/?act=viewthread&threadid;=451 ÔÚ06-2-23£¬Cn.popeye <cn-poper at 126.com> дµÀ£º import os import time source = [r'e:\temp\code',r'e:\temp\domains'] target_dir = r'e:\temp\bak' target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar' rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source)) print rar_cmd if os.system(r'cd D:\Program Files\WinRAR') == 0: if os.system(rar_cmd) == 0: print 'Successful backup to',target else: print 'Backup Failed!' else: print 'FAILED!!!' 'rar' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò »òÅú´¦ÀíÎļþ¡£ rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains Backup Failed! µ«ÊÇÔÚcmdÃüÁîÐÐÖ´ÐÐrar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains ÊÇ¿ÉÒԳɹ¦µÄ£¬ÕâÊÇΪʲô£¿£¿ Àñ£¡ Ö Àñ£¡ Cn.popeye cn-poper at 126.com 2006-02-23 _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -- Andelf BLOG:http://blog.sohu.com/members/andelf/ BLOG: http://spaces.msn.com/members/andelf = = = = = = = = = = = = = = = = = = = = = = ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Ö Àñ£¡ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Cn.popeye ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cn-poper at 126.com ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2006-02-24
Zeuux © 2025
京ICP备05028076号