报错:
1.local variable 'allreciver' referenced before assignment .
'allreciver' 变量无效
2.invalid literal for int() with base 10:
字段中用了int类型,说明有的字段不一致.需要调相关表字段的类型
也有可能提示的字段传过来的值是空的才报出这样的错误。
3.Attempted access to '/tmp/Cam000187.JPG' denied.
在后台管理中出错原因是:
headshot = models.ImageField(upload_to='/tmp')
去掉斜线"/"改成
headshot = models.ImageField(upload_to='tmp')
4.'instancemethod' object is unsubscriptable'
Request Method: POST
Request URL: http://127.0.0.1:8000/vendor/insert
Exception Type: TypeError
Exception Value: 'instancemethod' object is unsubscriptable
Exception Location: D:\workspace\spaq\vendor\opvendor.py in save, line 22
第22行代码是:request.POST.get['vendorcode','']
应改成
request.POST.get('vendorcode','')
5.Exception Value: 'VENDORID' is an invalid keyword argument for this function
6.not enough arguments for format string
是字符串不充分,需要格式化
错误例子:
sql = """
select
* from
t_sale s , t_products p ,t_custom c
where
s.pr = p .proe and s.w= c.licno
%s
%s
%s
""" % ("" if self.cxt.request.user.is_superuser else " and manufactcode = '%s'" % self.cxt.request.user.organization_code,
" and p.productsort_code = '%s'"%productsort_code if productsort_code else " ",
" and p.productname like '%%%s%%' "%productname,
)
修改的地方是:" and p.productname like '%%%s%%' "%productname,
应改为:" and p.productname like '%%%%%s%%%%' "%productname,多加两个%号
6.ORA-00920: invalid relational operator
无效的数据关联操作
7. 'module' object has no attribute 'contact'
module中没有contact这个对像
8.ViewDoesNotExist at /
Could not import bbs.section. Error was: No module named util.pageRequest Method: GET
Request URL: http://127.0.0.1:8000/
Exception Type: ViewDoesNotExist
Exception Value: Could not import bbs.section. Error was: No module named util.page
util下有page文件的,但是就是报错
原因是util文件夹下的文件要以包形式在其它文件引用的话,util文件夹下必须包含__init__.py文件
MultiValueDictKeyError at /usrctrol/section/add/
"Key 'se_province_name' not found in <QueryDict: {}>"
9. Tried index in module mysite.form_contact. Error was: 'module' object has no attribute 'index'
urls.py中配置的路径错误