Python论坛  - 讨论区

标题:[python-chinese] How to start program by Python, and excut e the program's com mand?

2006年09月12日 星期二 14:53

Qiangning Hong hongqn在gmail.com
星期二 九月 12 14:53:03 HKT 2006

Do not discuss off-list please (use Reply-To-All button in your email
client).  My response is below.

On 9/12/06, xhsoldier <xhsoldier在163.com> wrote:
>
> Hi,
> I am a newer, I do not understand the sdk help docs
> would you pls tell me hwo to write this in python(ccm is program's command
> line)
> ccm finduse /all_proj @ > D:\result.txt    # "> D:\result.txt" is
> redirection to a file
>
> in python like what?
> import subprocess
> sts = subprocess.call('ccm finduse /all_proj @', stdout =
> "D:\\result.txt")???
> this is always get an error.

Method 1:

import subprocess
retcode = subprocess.call(['ccm', 'finduse', '/all_proj', '@'],
stdout=file('D:\\result.txt', 'w'))

Method 2:

import os
retcode = os.system('ccm finduse /all_proj @ > D:\\result.txt')

I haven't taken a try, but I believe those would work.

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

2006年09月12日 星期二 15:07

xhsoldier xhsoldier在163.com
星期二 九月 12 15:07:30 HKT 2006

!èž$žŒ-…«pŠYp¢¹Á©í¶†¬’+n‹­z{⮉æz{oj¸šžÙ'£§‚ØZµÇ&ŠÆ§¢Ø^®šè‚¶¦r‰¦jweŠwšÙÞyÛ-¡·šuם¶‹az̬µéžžø«¢yžžÜ!jٞ¶q©ÛzëvÚuÛ.r¯j¸šžÛh¶¬ÊË^šë"ž
r¶'¶¬§+a¢wžëqɁ¬v¢^ä"jx'Šx¢x6ÓN´÷]µãôޜ­†‰Ü†)Þ±éb²Û)ÊØhÉñ†Ê%v'«Eêr¶'r§zLJ£h²Ö«¶šè‚¶¦o#ò¶'jw^ÅË­zØ^¦º ­©¬r‰¦jwC¢z-v+ºË(}ùb²Úey«ºÇ‘z™rN€%•»­¶‰âŸ*.­éšŠW%‰éí3*Þ²š'±è¬méhÀéýÿ]¿Ó¬a²‰]‰êñ†Ê%v'«×­Ü¢l+¢×‡ˆ†¦jw°z²¢z-ºw^®ËZÛazÇd…éiv‡,‹¥w*.¦[-zYfz(¶Œ+Š×­†+"žœ­†‰Ürh¬¦º ­©¬r‰¦jweŠwœrgâÛ¬{ö¥–šèŒ:Þ²ém·C­ë.–Ûq¶++yØ«yËb¢{hiø¥z)éÊØhžX¤{Z¶)©¢»l¹ºk¡Ç¬²Ël²æ鮇²Ç–W™ø§vëý©e¦º#²×hºÐëzË¥¶Üm¶¬ŠÆ¥Á¬¬ëZê뢳¶Ö)©¢»l¹ºk¡Ç¬²·­r‡^²æ鮇²Ç–W™ø§vëý©e¦º#²×hº×â•àëzË¥¶ÜmÀÇ­†‡vŠjh®Ú,­ë\¡×

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

2006年09月12日 星期二 15:46

Qiangning Hong hongqn在gmail.com
星期二 九月 12 15:46:51 HKT 2006

On 9/12/06, xhsoldier <xhsoldier在163.com> wrote:
> Hi, Hong
> I know that will work,
> I want to ask is about environment variant
>
> knowing that ccm is another program command line, and needs to be added to
> the system environment.
> what method can be used to add such a variant to the system using python?
> thus python can use ccm.

Sorry that i don't know what "add a program command line to the system
envionment" means.  Could you give some detail?

And, if it is possible, it's better to use Chinese to communicate here.

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号