Python Ubuntu bug汇总

Posted hpcm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python Ubuntu bug汇总相关的知识,希望对你有一定的参考价值。

问题1: Django

File "/home/bsodgm/Desktop/Django_projection/mall/apps/users/views.py", line 9, in <module>
from .models import User
File "/home/bsodgm/Desktop/Django_projection/mall/apps/users/models.py", line 6, in <module>
class User(AbstractUser):
File "/home/bsodgm/.virtualenvs/django_py3/lib/python3.5/site-packages/django/db/models/base.py", line 118, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class apps.users.models.User doesn‘t declare an explicit app_label and isn‘t in an application in INSTALLED_APPS.

解决1: from导入路径出错


问题2: Django

AttributeError: Got AttributeError when attempting to get a value for field `password2` on serializer ` UserSerializer`.
The serializer field might be named incorrectly and not match any attribute or key on the `User` instance.
Original exception text was: ‘User‘ object has no attribute ‘password2‘.
ERROR basehttp 124 "POST /users/ HTTP/1.1" 500 20189
pydev debugger: process 22712 is connecting

解决2: serializer中没有write_only_fields关键字, 需要在字段中加write_only=True


问题3:  Django

SystemCheckError: System check identified some issues:

ERRORS:
users.Test.groups: (fields.E304) Reverse accessor for ‘Test.groups‘ clashes with reverse accessor for ‘User.groups‘.
HINT: Add or change a related_name argument to the definition for ‘Test.groups‘ or ‘User.groups‘.
users.Test.user_permissions: (fields.E304) Reverse accessor for ‘Test.user_permissions‘ clashes with reverse accessor for ‘User.user_permissions‘.
HINT: Add or change a related_name argument to the definition for ‘Test.user_permissions‘ or ‘User.user_permissions‘.
users.User.groups: (fields.E304) Reverse accessor for ‘User.groups‘ clashes with reverse accessor for ‘Test.groups‘.
HINT: Add or change a related_name argument to the definition for ‘User.groups‘ or ‘Test.groups‘.

解决3: 在setting中注册user: AUTH_USER_MODEL = "users.User"


问题4: Django

TypeError: argument to reversed() must be a sequence
ERROR basehttp 124 "GET /admin/ HTTP/1.1" 500 114103
Performing system checks...

 

解决4: Django

路由中出现使用需要使用[ ]而不是{ }的情况!

 

问题5: Django

ValueError: Unable to configure filter ‘require_debug_true‘: Cannot resolve ‘django.app_keys.log.RequireDebugTrue‘: No module named ‘django.app_keys‘
或者:
ImportError: Could not import ‘app_keys.pagination.StandardResultsSetPagination‘ for API setting ‘DEFAULT_PAGINATION_CLASS‘. ImportError: No module named ‘app_keys‘.
pydev debugger: process 28636 is connecting

 

解决5: setting日志中的filter中的路径被快捷修改文件名给修改了

注意bug调试优先查看url是否对上, 未对上, 先看后端url是否对, 如果对检查前端代码

 

问题6: django

django.core.exceptions.ImproperlyConfigured: Cannot import ‘Payment‘. Check that ‘payment.apps.PaymentConfig.name‘ is correct.

解决: apps中的name首字母为小写, 但是被修改为大写了


问题7: ubuntu python pip

安装时出现Cannot uninstall ‘httplib2‘. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

解决7: sudo pip install --ignore-installed httplib2

 

问题8: ubuntu pycharm python

pycharm中不能安装python脚本, pip安装需要权限, 为知笔记不能使用输入法

解决: 将操作的项目和虚拟环境修改为当前用户:
sudo chown hpcm:hpcm 文件名 修改组名和用户名
sudo chowm -R hpcm:hpcm 文件名 递归修改

 

问题: pycharm中快捷件不能用(自动格式化)
解决: 与其他软件发生冲突:
1. 系统锁屏
2. 网易云等


问题: Traceback (most recent call last):
File "03-12306.py", line 17, in <module>
f.write(response)
TypeError: expected a string or other character buffer object

解决:
没有将二进制数据流解析出来:
data.read()







































以上是关于Python Ubuntu bug汇总的主要内容,如果未能解决你的问题,请参考以下文章

Bug 汇总

PyTorch(BUG汇总)—PyTorch遇到令人迷人的BUG与记录

苹果新品bug汇总,这些“坑”你确定不来看一看?

iOS14 BUG汇总!哪些机型可以更新?

独家K8S漏洞报告 | 近期bug fix解读&1.9.11主要bug fix汇总

iOS14已知BUG汇总!