【问题标题】:Error while using python supprocess.call method ,使用 python supprocess.call 方法时出错,
【发布时间】:2014-11-21 13:15:16
【问题描述】:
subprocess.call("exit 1", shell=True)
AttributeError: 'module' object has no attribute 'call', 

这是我在 Linux 中编译时收到的错误, 这是源代码:

import subprocess
import sys
import random
import os


subprocess.call("exit 1", shell=True)

【问题讨论】:

  • 也许你命名了你的一个模块(或者可能是当前模块)subprocess.py。尝试打印subprocess.__file__

标签: python linux subprocess


【解决方案1】:

您在同一目录中是否有名称为subprocess 的文件或文件夹?您似乎没有导入正确的核心模块。

【讨论】:

    猜你喜欢
    • 2021-07-26
    • 2021-01-16
    • 2015-03-06
    • 2010-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多