Python论坛  - 讨论区

标题:[python-chinese] 调用外部命令,有空格出错

2007年05月17日 星期四 21:50

李鹏 jeffskylee在163.com
星期四 五月 17 21:50:32 HKT 2007

大家好:

	  command = '"D:\Program Files\UltraEdit-32\Uedit32.exe" "D:\1.xml"'
      os.popen(command) --  运行没反应
      os.execv( 'D:\Program Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])     ---
      os.execvp( 'D:\Program Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])    ---  打开了uedit32,但是去在当前的工程目录中新建了一个1.xml文件
      os.system(command)  -- 'D:\Program' 不是内部或外部命令,也不是可运行的程序或批处理文件。
   subprocess.Popen(command, shell=True)   -- 'D:\Program' 不是内部或外部命令,也不是可运行的程序或批处理文件。

      为什么没有一个可以正常运行的啊

     致
礼!
 				

        李鹏
        jeffskylee在163.com
          2007-05-17

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

2007年05月18日 星期五 09:07

头太晕 torrycn在gmail.com
星期五 五月 18 09:07:56 HKT 2007

>>> import os
>>> os.popen('\"notpad.exe d:\\11.txt\"')

ÔÚ07-5-17£¬ÀîÅô <jeffskylee在163.com> дµÀ£º
>
> ´ó¼ÒºÃ:
>
>           command = '"D:\Program Files\UltraEdit-32\Uedit32.exe"
> "D:\1.xml"'
>       os.popen(command) --  ÔËÐÐû·´Ó¦
>       os.execv( 'D:\Program
> Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])     ---
>       os.execvp( 'D:\Program
> Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])    ---  ´ò¿ªÁËuedit32£¬
> µ«ÊÇÈ¥ÔÚµ±Ç°µÄ¹¤³ÌĿ¼ÖÐн¨ÁËÒ»¸ö1.xmlÎļþ
>       os.system(command)  -- 'D:\Program' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> subprocess.Popen(command, shell=True)   -- 'D:\Program'
> ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
>
>       ΪʲôûÓÐÒ»¸ö¿ÉÒÔÕý³£ÔËÐеİ¡
>
> ÖÂ
> Àñ£¡
>
>
> ÀîÅô
> jeffskylee在163.com
> 2007-05-17
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070518/743cec1e/attachment.html 

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

2007年05月18日 星期五 09:16

头太晕 torrycn在gmail.com
星期五 五月 18 09:16:43 HKT 2007

Èç¹ûÃüÁî±¾ÉíÓпոñ,»¹ÒªÔÙ¼Ó²ÎÊý,¾Í¶àǶÌ×Ò»²ãÒýºÅ,ÀýÈçÕâÑù:

>>> cmd='\"\"D:\\Program Files\\Microsoft Office\\OFFICE11\\winword.exe\"
\"d:\\11.doc\"\"'
>>> os.popen(cmd)


ÔÚ07-5-18£¬Í·Ì«ÔÎ <torrycn在gmail.com> дµÀ£º
>
> >>> import os
> >>> os.popen('\"notpad.exe d:\\11.txt\"')
>
> ÔÚ07-5-17£¬ÀîÅô <jeffskylee在163.com > дµÀ£º
> >
> > ´ó¼ÒºÃ:
> >
> >           command = '"D:\Program Files\UltraEdit-32\Uedit32.exe"
> > "D:\1.xml"'
> >       os.popen(command) --  ÔËÐÐû·´Ó¦
> >       os.execv( 'D:\Program
> > Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])     ---
> >       os.execvp( 'D:\Program
> > Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])    ---  ´ò¿ªÁËuedit32£¬
> > µ«ÊÇÈ¥ÔÚµ±Ç°µÄ¹¤³ÌĿ¼ÖÐн¨ÁËÒ»¸ö1.xmlÎļþ
> >       os.system(command)  -- 'D:\Program' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> > subprocess.Popen(command, shell=True)   -- 'D:\Program'
> > ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> >
> >       ΪʲôûÓÐÒ»¸ö¿ÉÒÔÕý³£ÔËÐеİ¡
> >
> > ÖÂ
> > Àñ£¡
> >
> >
> > ÀîÅô
> > jeffskylee在163.com
> > 2007-05-17
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070518/a042ccbe/attachment.html 

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

2007年05月18日 星期五 09:36

Tian askfor在gmail.com
星期五 五月 18 09:36:30 HKT 2007

editPlus = "D:\Program Files\EditPlus 2\editplus.exe"
os.execv(editPlus,(editPlus,result[int(offset)][0],"-cursor "+
str(result[int(offset)][1])+":"+str(result[int(offset)][3])))
os.spawnvp(os.P_WAIT,editPlus,(editPlus,result[int(offset)][0],"-cursor "+
str(result[int(offset)][1])+":"+str(result[int(offset)][3])))

ÎÒÒÔÇ°ÕâÑùдµÄ ÄÜ´ò¿ª


On 5/18/07, Í·Ì«ÔÎ <torrycn在gmail.com> wrote:
>
> Èç¹ûÃüÁî±¾ÉíÓпոñ,»¹ÒªÔÙ¼Ó²ÎÊý,¾Í¶àǶÌ×Ò»²ãÒýºÅ,ÀýÈçÕâÑù:
>
> >>> cmd='\"\"D:\\Program Files\\Microsoft Office\\OFFICE11\\winword.exe\"
> \"d:\\11.doc\"\"'
> >>> os.popen(cmd)
>
>
> ÔÚ07-5-18£¬Í·Ì«ÔÎ <torrycn在gmail.com> дµÀ£º
> >
> > >>> import os
> > >>> os.popen('\"notpad.exe d:\\11.txt\"')
> >
> > ÔÚ07-5-17£¬ÀîÅô < jeffskylee在163.com > дµÀ£º
> > >
> > > ´ó¼ÒºÃ:
> > >
> > >           command = '"D:\Program Files\UltraEdit-32\Uedit32.exe"
> > > "D:\1.xml"'
> > >       os.popen(command) --  ÔËÐÐû·´Ó¦
> > >       os.execv( 'D:\Program
> > > Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])     ---
> > >       os.execvp( 'D:\Program
> > > Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])    ---  ´ò¿ªÁËuedit32£¬
> > > µ«ÊÇÈ¥ÔÚµ±Ç°µÄ¹¤³ÌĿ¼ÖÐн¨ÁËÒ»¸ö1.xmlÎļþ
> > >       os.system(command)  -- 'D:\Program' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> > > subprocess.Popen(command, shell=True)   -- 'D:\Program'
> > > ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> > >
> > >       ΪʲôûÓÐÒ»¸ö¿ÉÒÔÕý³£ÔËÐеİ¡
> > >
> > > ÖÂ
> > > Àñ£¡
> > >
> > >
> > > ÀîÅô
> > > jeffskylee在163.com
> > > 2007-05-17
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070518/cbfa6a65/attachment.htm 

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

2007年05月18日 星期五 09:45

Tian askfor在gmail.com
星期五 五月 18 09:45:00 HKT 2007

²»ºÃÒâ˼
editPlus = "D:\Program Files\EditPlus 2\editplus.exe"
Ó¦¸ÃÓÃ
editPlus = "D:\\Program Files\\EditPlus 2\\editplus.exe"
²»È»Åö¼ûn r t aÖ®À࿪ͷµÄÓÐÎÊÌâ¡£

On 5/18/07, Tian <askfor在gmail.com> wrote:
>
> editPlus = "D:\Program Files\EditPlus 2\editplus.exe"
> os.execv(editPlus,(editPlus,result[int(offset)][0],"-cursor "+
> str(result[int(offset)][1])+":"+str(result[int(offset)][3])))
> os.spawnvp(os.P_WAIT,editPlus,(editPlus,result[int(offset)][0],"-cursor "+
> str(result[int(offset)][1])+":"+str(result[int(offset)][3])))
>
> ÎÒÒÔÇ°ÕâÑùдµÄ ÄÜ´ò¿ª
>
>
>  On 5/18/07, Í·Ì«ÔÎ <torrycn在gmail.com> wrote:
>
> > Èç¹ûÃüÁî±¾ÉíÓпոñ,»¹ÒªÔÙ¼Ó²ÎÊý,¾Í¶àǶÌ×Ò»²ãÒýºÅ,ÀýÈçÕâÑù:
> >
> > >>> cmd='\"\"D:\\Program Files\\Microsoft
> > Office\\OFFICE11\\winword.exe\" \"d:\\11.doc\"\"'
> > >>> os.popen(cmd)
> >
> >
> > ÔÚ07-5-18£¬Í·Ì«ÔÎ <torrycn在gmail.com> дµÀ£º
> > >
> > > >>> import os
> > > >>> os.popen('\"notpad.exe d:\\11.txt\"')
> > >
> > > ÔÚ07-5-17£¬ÀîÅô < jeffskylee在163.com > дµÀ£º
> > > >
> > > > ´ó¼ÒºÃ:
> > > >
> > > >           command = '"D:\Program Files\UltraEdit-32\Uedit32.exe"
> > > > "D:\1.xml"'
> > > >       os.popen(command) --  ÔËÐÐû·´Ó¦
> > > >       os.execv( 'D:\Program
> > > > Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])     ---
> > > >       os.execvp( 'D:\Program
> > > > Files\UltraEdit-32\Uedit32.exe',['D:\1.xml'])    ---  ´ò¿ªÁËuedit32£¬
> > > > µ«ÊÇÈ¥ÔÚµ±Ç°µÄ¹¤³ÌĿ¼ÖÐн¨ÁËÒ»¸ö1.xmlÎļþ
> > > >       os.system(command)  -- 'D:\Program' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> > > > subprocess.Popen(command, shell=True)   -- 'D:\Program'
> > > > ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò»òÅú´¦ÀíÎļþ¡£
> > > >
> > > >       ΪʲôûÓÐÒ»¸ö¿ÉÒÔÕý³£ÔËÐеİ¡
> > > >
> > > > ÖÂ
> > > > Àñ£¡
> > > >
> > > >
> > > > ÀîÅô
> > > > jeffskylee在163.com
> > > > 2007-05-17
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese在lists.python.cn
> > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> > >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070518/917b93f4/attachment-0001.html 

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号