小编Mor*_*hit的帖子

lxml中的POST方法表单使用submit_form引发TypeError

我正在尝试使用lxml提交POST方法表单,我得到一个TypeError.这是引发此错误的最小示例:

>>> import lxml.html
>>> page = lxml.html.parse("http://www.webcom.com/html/tutor/forms/start.shtml")
>>> form = page.getroot().forms[0]
>>> form.fields['your_name'] = 'Morphit'
>>> result = lxml.html.parse(lxml.html.submit_form(form))
    Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
            File "/usr/lib/python3.3/site-packages/lxml/html/__init__.py", line 887, in submit_form
              return open_http(form.method, url, values)
            File "/usr/lib/python3.3/site-packages/lxml/html/__init__.py", line 907, in open_http_urllib
              return urlopen(url, data)
            File "/usr/lib/python3.3/urllib/request.py", line 160, in urlopen
              return opener.open(url, data, timeout)
            File "/usr/lib/python3.3/urllib/request.py", line 471, in open
              req = meth(req)
            File "/usr/lib/python3.3/urllib/request.py", line 1183, in do_request_
              raise TypeError(msg)
          TypeError: POST data …
Run Code Online (Sandbox Code Playgroud)

python lxml python-3.x

10
推荐指数
1
解决办法
1098
查看次数

为什么git-pull会因信号13而失败?

建立

我写了一个小脚本来自动提取/提交/推送一些个人数据.这个脚本在我的笔记本电脑上很好用(版本1.8.3.2-1),但在我的服务器上,git pull命令失败了,信号13.我运行的是1.7.9.5-1版本(这些都是ubuntu,但是服务器是12.04.4 LTS vs 13.10在笔记本电脑上),我使用ppa:git-core repo将git更新为1.9.0-1~ppa0~precision1.这仍然会给我的脚本带​​来同样的问题.可能的复杂性是,笔记本电脑从服务器上的裸仓库通过ssh拉出,而服务器从同一个裸仓库(到其他地方的工作副本)拉出但不使用ssh,它只有本地路径.

问题

我可以使用以下命令在终端中重现该问题:

> git pull origin master | read msg; echo ${msg}
First, rewinding head to replay your work on top of it...
error: git-pull died of signal 13
Run Code Online (Sandbox Code Playgroud)

这似乎是获取提交并检查它,但不更新主分支并使repo离开分支:

> git status
# Not currently on any branch.
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)

切换回master会发出警告:

> git checkout master
Warning: you are leaving 1 commit behind, not connected to
any of your branches:

  7220b8f Commit message

If you want to …
Run Code Online (Sandbox Code Playgroud)

git bash shell git-pull

2
推荐指数
1
解决办法
2247
查看次数

标签 统计

bash ×1

git ×1

git-pull ×1

lxml ×1

python ×1

python-3.x ×1

shell ×1