AttributeError: 'unicode' object has no attribute 'tzinfo' 未解决
Internal Server Error: /demo/machineinfo.html
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\handlers\exception.py", line 41, in inner
response = get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "G:\python\project\myApp\machineviews.py", line 25, in htmlmachineinfo
print machineinfo.objects.filter(serialNumber=machineser)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 226, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 250, in __iter__
self._fetch_all()
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 1118, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 62, in __iter__
for row in compiler.results_iter(results):
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 842, in results_iter
row = self.apply_converters(row, converters)
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 827, in apply_converters
value = converter(value, expression, self.connection, self.query.context)
File "C:\Python27\lib\site-packages\django\db\backends\mysql\operations.py", line 239, in convert_datetimefield_value
value = timezone.make_aware(value, self.connection.timezone)
File "C:\Python27\lib\site-packages\django\utils\timezone.py", line 285, in make_aware
return timezone.localize(value, is_dst=is_dst)
File "C:\Python27\lib\site-packages\pytz\__init__.py", line 222, in localize
if dt.tzinfo is not None:
AttributeError: 'unicode' object has no attribute 'tzinfo'
临时决解方案把数据库里面的
models.DateTimeField(auto_now_add=True)
相关时间语句先注释掉,然后在执行,目前还没找到解决办法,先绕过
后续有决解办法在进行更新
AttributeError: 'unicode' object has no attribute 'tzinfo' 未解决的更多相关文章
- celery:Unrecoverable error: AttributeError("'unicode' object has no attribute 'iteritems')
环境描述 python2+django1.9下使用celery异步处理耗时请求. celery使用的是celery-with-redis这个第三方库,版本号为3.0. pip install cele ...
- 对于AttributeError: 'Flask' object has no attribute 'cli'的解决办法
版权声明:本文为博主原创文章,未经博主允许不得转载. 环境flask-script2.0.5.flask0.10.1 运行官方文档sample 出现问题 c:\kk\flask\examples\fl ...
- PyQt程序执行时报错:AttributeError: 'winTest' object has no attribute 'setCentralWidget'的解决方法
用QtDesigner设计了一个UI界面,保存在文件Ui_wintest.ui中,界面中使用了MainWindow窗口,窗口名字也叫MainWindow,用PyUIC将其转换成了 Ui_wintest ...
- AttributeError: 'module' object has no attribute 'X509_up_ref'
主要报错: AttributeError: 'module' object has no attribute 'X509_up_ref' 1 解决办法 卸载再重装pyOpenSSL pip unins ...
- 在运行create_list.sh时候报错:AttributeError: 'module' object has no attribute 'LabelMap'
Traceback (most recent call last):File "/opt/xuben-project/caffe/data/VOC0712/../../scripts/cre ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- AttributeError: 'list' object has no attribute 'write_pdf'
我在可视化决策树,运行以下代码时报错:AttributeError: 'list' object has no attribute 'write_pdf' 我使用的是python3.4 from sk ...
- attributeError:'module' object has no attribute ** 解决办法
写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...
- AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'
/*************************************************************************** * AttributeError: 'modu ...
随机推荐
- 基于HTML的购物车模型的代码设计
HTML代码 <html lang="en"> <head> <meta charset="UTF-8"> < ...
- uni-app实现多端开发
多端开发,听名字就感觉不一样,一套代码.多端使用,适用于各个平台.市面上很多关于多端开发的框架,比较常用,流行的框架 uni-app,Chameleon(变色龙),taro这些,都可以支持多端,一套代 ...
- Java连载62-使用throws关键字处理异常
一.处理异常的两种方式 1.所有的编译时异常,要求程序员在编写程序阶段,必须对它进行处理,如果不处理的话,编译就会无法通过,处理异常有两种方法:捕捉和声明抛出. 2.捕捉:try.....catch ...
- Office安装时报错1907的解决方法
大家在装office时可能遇到过1907错误,字体无法注册 的问题,百度后者是采用什么四种方法,我四种方法都试过了没有用,也有人说缺什么日本字体,我也试过了没有用,做为有强迫证的我都重做系统,重下载o ...
- Linux 命令行初始化MySQL数据库
作为一个技术纯小白,在Linux服务器初始化MySQL数据库的时候遇到了一点小问题: 1.不会使用MySQL图形工具,几乎没玩过 2.客户的VPN没有开放3306端口,没法用navicat等工 ...
- JavaScript图形实例:纺织物图案
1.简单纺织物图案 先在HTML页面中设置一个画布. <canvas id="myCanvas" width="360" height="240 ...
- ASP.NET Core on K8S深入学习(11)K8S网络知多少
本篇已加入<.NET Core on K8S学习实践系列文章索引>,可以点击查看更多容器化技术相关系列文章. 一.Kubernetes网络模型 我们都知道Kubernetes作为容器编排引 ...
- strcmp函数和memcmp函数的用法区别及联系
前言: C语言中有很多东西容易搞混,最近笔者就遇到了一个问题.这里做个记录.就是memcmp和strcmp两者的用法,这里做个对比: 功能对比: A memcmp: 函数原型: int memcmp( ...
- arcgis api 4.x for js 自定义叠加图片图层实现地图叠加图片展示(附源码下载)
前言 关于本篇功能实现用到的 api 涉及类看不懂的,请参照 esri 官网的 arcgis api 4.x for js:esri 官网 api,里面详细的介绍 arcgis api 4.x 各个类 ...
- 为什么 netstat 对某些服务只显示了 tcp6 监听端口
最近偶尔发现一个比较奇怪的现象,netstat 查看监听的服务端口时,却只显示了 tcp6 的监控, 但是服务明明是可以通过 tcp4 的 ipv4 地址访问的,那为什么没有显示 tcp4 的监听呢? ...