找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 2165|回复: 0

[求助] 用Pip安装Tidy之后运行一段小代码报错

3

主题

6

帖子

6

积分

贫民

积分
6
DisPanda 发表于 2017-12-9 03:04:31 | 显示全部楼层 |阅读模式
我在cmd中运行pip.exe install pytidylib
安装完成后下载了LIBTIDY.dll放在Script文件夹中;

然后运行了这一段代码(Python基础教程上的):
from subprocess import Popen,PIPE

text=open('Exam.html').read()
tidy=Popen('tidy',stdin=PIPE,stdout=PIPE,stderr=PIPE,shell=True)
#print tidy

tidy.stdin.write(text)
tidy.stdin.close()

print tidy.stdout.read()

然后报错:
Traceback (most recent call last):
  File "D:\Python27\Save\htmltext.py", line 6, in <module>
    tidy.stdin.write(text)
IOError: [Errno 32] Broken pipe

请问各位大神们是哪里出错了?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表