是否有新的/更新的斜纹布? [英] Is there a new/updated Twill?

查看:78
本文介绍了是否有新的/更新的斜纹布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在Python上学习Twill脚本,并且我正在使用 Python 3.4和Twill 1.8.0 .在这里读了一些帖子,我发现学习很有趣.但是,我确实在安装Twill时遇到问题.我只是知道Python中的 PRINT 现在是一个函数,因此意味着它需要括号,这就是我的问题所在.当我浏览Twill 1.8.0上的代码时,我认为它尚未适应使用PRINT的更改.字符串不是用括号括起来的,所以我在想也许有一个新的Twill补丁或版本可以适应Python的变化,是否有?还是除了手动编辑Twill文件外,我还能做些什么?

非常感谢您的回复.

解决方案

GM的回答仅部分解决了我的问题(在Windows上使用Python 3.6).下载 Twill 1.8.0 并用2to3进行转换只是第一步.

然后,我必须安装缺少的软件包:

pip install lxml
pip install requests
pip install pypiwin32
pip install cssselect

此外,我不得不修复Python36/lib/site-packages/twill/other_packages/中的两个文件: 在subprocess.py中,我在第392行中用False = 0删除了该节,并在第353行中将if 0:更改为if 1:以避免使用_subprocess. 最后,在pyparsing.py中,我用.lower()替换了.lowercase,并用.upper()替换了.uppercase.

I've been trying to learn Twill Scripting on Python and I am using Python 3.4 and Twill 1.8.0. Been reading some posts here and I found it interesting to study. But, I do have a problem installing Twill. I just knew that PRINT in Python is now a function so meaning it needs parenthesis and that's where my problem starts. As I look through the codes on Twill 1.8.0, I think it isn't oriented with the change of using PRINT yet. Strings are not enclosed with parenthesis so I was thinking maybe there is a new patch or version of Twill that adapts the changes of Python, is there any? or is there anything I can do about this aside from manually editing Twill files?

Your response is highly appreciated.

解决方案

GMs answer only partly solved the problem for me (using Python 3.6 on Windows). Downloading Twill 1.8.0 and converting it with 2to3 was only the first step.

Afterwards, I had to install missing packages:

pip install lxml
pip install requests
pip install pypiwin32
pip install cssselect

Furthermore, I had to fix two files in Python36/lib/site-packages/twill/other_packages/: In subprocess.py, I removed the section with False = 0 at line 392 and changed if 0: to if 1: in line 353 to avoid using _subprocess. Finally, in pyparsing.py, I replaced .lowercase with .lower() and .uppercase with .upper().

这篇关于是否有新的/更新的斜纹布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆