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 ...
随机推荐
- git 知识,适合新手 滤清思路
1,密钥 (公钥和私钥) @ 公钥放在服务器上(说白了这里的服务器就是远程仓库, 就是谁建立的远程仓库这个公钥就放在他的ssh设置那) @ 私钥 放在本地就行,不用动,就是你生产密钥的.ssh 文件里 ...
- TrueTime的安装、运行例程
一.前言 Truetime的安装是为了完成课程相关需求,但在安装过程中遇到一些问题,想到自己之前注册了博客所以打算把这个作为第一篇的内容.请放心这个的安装过程并不困难,可以放心食用. 二.准备 Tru ...
- ASP.NET Core身份验证
asp.net core 身份验证 本文旨在演示如果使用内置的 identity 实现 asp.net core 的身份验证,不会进行其它扩展.本文将通过最简单的代码演示如何进行登录和身份验证操作. ...
- 【30天自制操作系统】day03:读写磁盘
软盘 80个柱面,2个磁头,18个扇区 每个扇区 512 字节,共 1440 KB 读磁盘汇编 读取 10 个柱面到 0x0820 内存位置 ;读取磁盘 MOV AX,0x0820 MOV ES,AX ...
- 一篇文章看懂JS闭包,都要2020年了,你怎么能还不懂闭包?
壹 ❀ 引 我觉得每一位JavaScript工作者都无法避免与闭包打交道,就算在实际开发中不使用但面试中被问及也是常态了.就我而言对于闭包的理解仅止步于一些概念,看到相关代码我知道这是个闭包,但闭包 ...
- 大话设计模式Python实现-迭代器模式
迭代器模式(Iterator Pattern):提供方法顺序访问一个聚合对象中各元素,而又不暴露该对象的内部表示. 下面是一个迭代器模式的demo: #!/usr/bin/env python # - ...
- 【数据库】SQLite3常用函数
版权声明:本文为博主原创文章,转载请注明出处. https://www.cnblogs.com/YaoYing/ SQLite3常用函数 打开数据库 函数原型: int sqlite3_open(co ...
- AWVS12破解版使用
本篇简单介绍AWVS12破解版的安装使用,如果您已经安装了AWVS 10.5的版本,不用卸载,可以共存. AWVS12破解版下载链接:https://github.com/starnightcyber ...
- VS 2017 代码报错编译正常
今天遇到一个奇葩的错误,代码报红波浪线错误,但编译正常,程序能正常运行; 解决方法 在项目引用中把报错的代码所在项目先移除,再重新引用,然后编译一下就好了
- spring4 学习4 spring MVC+mybatis+Mysql
在前面搭建的基础上,引入新的jar包如下: aopalliance-1.0.jaraspectjweaver-1.8.8.jarmybatis-3.3.0.jarmybatis-spring-1.2. ...