【发布时间】:2010-06-09 13:55:10
【问题描述】:
我想从 python 脚本运行一个 csh 文件,
例子,
#!/usr/bin/python
import os
os.system("source path/to/file.csh")
我希望这个文件在我运行 python 脚本时在同一个 shell 中运行,因为file.csh 脚本设置了一些我需要的环境变量。
有人知道如何在 Python 中做到这一点吗?
【问题讨论】:
-
我想用 source 命令运行 file.csh 但它不正确,os.system("source path/to/file.csh")
-
看看
subprocess模块
标签: python subprocess