文章目录
前言
总结遇到的BUG与问题
一、Python相关
1、文件打开:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb0 in position 17: invalid start byte
解决办法:文件以utf-8另存
2、jieba:AttributeError: module ‘jieba’ has no attribute ‘analyse’
错误代码:
import jieba
tfidf = jieba.analyse.extract_tags
解决办法:
import jieba.analyse as analyse
tfidf = analyse.extract_tags
3、字符串:TypeError: not enough arguments for format string
错误代码
print("你的输入为:%s(%d)"%h%admin))
改正代码,只用加一个%
print("你的输入为:%s(%d)"%(h,admin))
此外,还可能是前面的代码过长,%与变量没有对应好。
二、IDEA相关
1、工件部署失败
重新加载工件中的包
2、listener响应问题
tomcat版本过高(10.0)
3、500内部服务器错误
nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml
解决办法:重新部署Web文件夹
4、500变量空指针
Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "imu.zhao.springtest2.dao.LoginLogDao.selectLoginLog(String)" because "this.loginLogDao" is null
解决办法:查看该变量的@Autowired是否添加
5、500数据库列名not found
可能是SQL语句没空格!
6、Timestamp获取当前时间戳
Timestamp()与数据库中datetime对应;此外还有Date()
Timestamp d = new Timestamp(System.currentTimeMillis());//当前时间戳
7、前端列表显示数据库
无需< c >版:
<div class="container">
<h3 align="center">日志列表</h3>
<table align="center">
<tr class="success">
<th>用户编号</th>
<th>用户名</th>
<th>用户登录时间</th>
<th>用户ip</th>
</tr>
<%
List<LoginLog> k=(List<LoginLog>)request.getAttribute("list");
for(int i=0;i< k.size();i++){
%>
<tr>
<td><%=k.get(i).userId%></td>
<td><%=k.get(i).username%></td>
<td><%=k.get(i).loginDate%></td>
<td><%=k.get(i).ip%></td>
</tr>
<% }%>
</table>
</div>
List < LoginLog >:LoginLog方法中存各种变量,省略setter和getter
public class LoginLog implements Serializable {
public int loginLogId;
public String username;
public int userId;
public String ip;
public Timestamp loginDate;//原来是DATE
}
三、cmd相关
1、CD+文件路径不转跳?
cd \d 文件名 //加\d