Python论坛  - 讨论区

标题:[python-chinese] 'rar' 不是内部或外部命令,也不是可运行的程序?????

2006年02月23日 星期四 16:51

Cn.popeye cn-poper at 126.com
Thu Feb 23 16:51:13 HKT 2006

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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年02月23日 星期四 16:53

Qi Ivan qihboy at gmail.com
Thu Feb 23 16:53:40 HKT 2006

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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年02月23日 星期四 17:31

Andelf andelf at gmail.com
Thu Feb 23 17:31:21 HKT 2006

看简明的时候遇到的问题吧
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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年02月23日 星期四 17:34

大郎 iexper at gmail.com
Thu Feb 23 17:34:05 HKT 2006

我在测试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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年02月24日 星期五 11:21

Cn.popeye cn-poper at 126.com
Fri Feb 24 11:21:30 HKT 2006

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


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号