Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这个项目非常棒!!!修复一个小bug #35

Closed
ghLcd9dG opened this issue Mar 2, 2022 · 2 comments
Closed

这个项目非常棒!!!修复一个小bug #35

ghLcd9dG opened this issue Mar 2, 2022 · 2 comments

Comments

@ghLcd9dG
Copy link

ghLcd9dG commented Mar 2, 2022

项目中用到了demjson,demsjon包在python的setuptools 58.0版本以后就不再被python3支持
目前demjson项目特别划分出了一个项目分支demjson3:

https://pypi.org/project/demjson3/

具体参见issue:
dmeranda/demjson#40

改法有两个:

  1. 项目中用到demjson的地方修改为demjson3即可
  2. setuptools降级低于58.0(亲测即便在58.0以前也并不是所有的版本都支持)

以下为报错信息:
Internal Server Error: /api/xadmin/v1/sys/menu
File "C:\Users\xuyic\anaconda3\envs\py36\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "C:\Users\xuyic\anaconda3\envs\py36\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Users\xuyic\Downloads\django-antd-tyadmin-master\django-antd-tyadmin-master\demos\tyadmin_demo_init\tyadmin_api\views.py", line 72, in get
content = demjson.decode(content)
File "C:\Users\xuyic\anaconda3\envs\py36\lib\site-packages\demjson.py", line 2039, in decode
j = JSON( strict=strict )
File "C:\Users\xuyic\anaconda3\envs\py36\lib\site-packages\demjson.py", line 911, in init
for c in range(0,256)]
File "C:\Users\xuyic\anaconda3\envs\py36\lib\site-packages\demjson.py", line 911, in
for c in range(0,256)]AttributeError: 'dict' object has no attribute 'has_key'

报错的主要原因是Python3以后删除了has_key()方法,可以把has_key换成in方法解决这个报错,但是也不推荐,因为demjson项目中并不是只有这一点不兼容python3,还有挺多地方,改起来非常麻烦。

项目环境:
python==3.6
django==3.3

望采纳,额外补充一句,感谢作者大大的好项目!救命了!

@mtianyan mtianyan pinned this issue Mar 6, 2022
mtianyan added a commit that referenced this issue Apr 9, 2022
- 替换demjson 为demjson3解决安装依赖问题 #35 #36
- 修复添加用户密码为明文的问题 #12
@mtianyan
Copy link
Owner

mtianyan commented Apr 9, 2022

@xuyichenmo 已发布0.8.2 版本修复该问题

@mtianyan mtianyan closed this as completed Apr 9, 2022
@mtianyan mtianyan unpinned this issue Apr 9, 2022
@mocehu
Copy link

mocehu commented Mar 5, 2024

@xuyichenmo 已发布0.8.2 版本修复该问题

requirements.txt文件中的包名是否应该一起更改,教程中写的pip install -r requirement.txt中的requirement.txt是否应该改成requirements.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants