python3安装feedparser

dreamhunter_lan 2011-06-22 06:18:30
看了readme,说是用2to3工具把这样搞:
2to3 -w feedparser.py feedparsertest.py
如果有sgmllib3.py就改为:sgmllib.py,然后
2to3 -w sgmllib.py
为啥都不行,为啥总是说没有sgmllib这个模块?python3没有这个模块了吗?那readme里面还让这样搞?唉
大家帮帮忙。各路大神!
...全文
457 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
dreamhunter_lan 2011-06-24
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 o_yale_o 的回复:]

没那么简单,要不
谁能把wxPython也来个2to3看看
[/Quote]
唉,是啊~~现在已经换python2.7了~~~不过还是希望能解决
o_yale_o 2011-06-24
  • 打赏
  • 举报
回复
没那么简单,要不
谁能把wxPython也来个2to3看看
dreamhunter_lan 2011-06-22
  • 打赏
  • 举报
回复
上面说错了,执行2to3 -w sgmllib.py的时候错误信息是这样的:
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Can't parse sgmllib.py: ParseError: bad input: type=22, value='=', context=('', (484, 43))
RefactoringTool: No files need to be modified.
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse sgmllib.py: ParseError: bad input: type=22, value='=', context=('', (484, 43))
dreamhunter_lan 2011-06-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 iambic 的回复:]

这是让你自己装一个python 2,把里面的sgmlib.py拷出来,如果你的feedparser里没有这个文件的话。
[/Quote]
后面的不是还说如果有sgmlib3.py的话就直接改为sgmlib.py吗?
现在的情况是:我执行2to3 -w feedparser.py feedparsertest.py有一个警告
执行2to3 -w sgmllib.py是说找不到module sgmllib
iambic 2011-06-22
  • 打赏
  • 举报
回复
这是让你自己装一个python 2,把里面的sgmlib.py拷出来,如果你的feedparser里没有这个文件的话。
dreamhunter_lan 2011-06-22
  • 打赏
  • 举报
回复
Universal Feed Parser
Parse RSS and Atom feeds in Python. 4000 unit tests. Open source.

Copyright (c) 2002-2008, Mark Pilgrim
Copyright (c) 2008-2010, multiple authors
open source, see LICENSE file for details

-----

If you're using Python 3, feedparser can be converted to work with Python 3 by
the 2to3 tool! To convert it, you can either run the convert_to_py3.sh, or you
can run the following command manually if there's a problem:

$ 2to3 -w feedparser.py feedparsertest.py

Unfortunately, sgmllib.py was deprecated in Python 2 and is no longer included
in Python 3. If a copy of sgmllib.py - ported to Python 3 - was not included
in your feedparser download, simply grab a copy from your Python 2 system
library (preferably from the Python 2.7 series) and run the 2to3 tool on it:

$ 2to3 -w sgmllib.py

You'll additionally need to edit the resulting file to remove the `warnpy3k`
lines at the top of the file. There should be four lines at the top of the file
that you can delete.

If your feedparser download included the sgmllib.py file, it's probably called
sgmllib3.py, and you can simply rename the file to sgmllib.py. (The "3"
prevents the file from conflicting with your system's existing sgmllib if
you're using Python 2.)

Because sgmllib is a part of the Python codebase, it's licensed under the
Python Software Foundation License. You can find a copy of that license at
python.org:

http://docs.python.org/license.html
iambic 2011-06-22
  • 打赏
  • 举报
回复
贴readme的链接看下。

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧