java调用python提示错误Exception in thread "main" Traceback ,请问如何解决?
澳门银河官网
澳门银河官网
当前位置 : 澳门银河官网 > 澳门银河官网

java调用python提示错误Exception in thread "main" Traceback ,请问如何解决?

Eclipse中java代码调用python脚本时提示错误Exception in thread "main" Traceback most recent call last:,请问如何解决?
Eclipse中配置了python2.7和jython2.7。
java代码如下:

package test;

import org.python.util.PythonInterpreter;

public class ThirdJavaScript {
    public static void mainString args[] {
        PythonInterpreter interpreter = new PythonInterpreter;
        interpreter.execfile"E:\\python\\python_demo\\see_xiaohua.py";
    }
}

python脚本代码如下:

# coding:utf-8
#!/usr/bin/python
import urllib2#与下面脚本对比没有被注释
import re#与下面脚本对比没有被注释
from bs4 import BeautifulSoup#与下面脚本对比没有被注释
number =0  #定义序号变量
page = raw_input"Please input page:"
user_agent = Mozilla/4.0 compatible; MSIE 5.5; Windows NT
headers = { User-Agent : user_agent }
request = urllib2.Requesthttp://www.qiushibaike.com/hot/page/+strpage+/?s=4915651,headers = headers
response = urllib2.urlopenrequest
html = response.read   #获取页面源码
soup = BeautifulSouphtml,"html.parser"
items = soup.find_alldiv,attrs={"class":"content"} #搜索div标签并且同时含有class=content内容

for item in items:
    number +=1
    pattern = re.compile<span>.*?</span>,re.S
    lists = re.findallpattern,stritem
    for list in lists:
        print NO,number,:,list.decodeutf-8,\n
    
print "End..."

运行时,控制台出现如下错误,请问如何修改?

栏目列表

广告位

澳门银河官网