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

报非法的十六进制 #221

Open
narutoexception opened this issue Jul 24, 2023 · 3 comments
Open

报非法的十六进制 #221

narutoexception opened this issue Jul 24, 2023 · 3 comments

Comments

@narutoexception
Copy link

python3 main.py
Traceback (most recent call last):
File "/Users/lay/python/jd-assistant-master/main.py", line 3, in
from jd_assistant import Assistant
File "/Users/lay/python/jd-assistant-master/jd_assistant.py", line 18, in
from util import (
File "/Users/lay/python/jd-assistant-master/util.py", line 12, in
from Crypto.PublicKey import RSA
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Crypto/PublicKey/init.py", line 21, in
from Crypto.Util.asn1 import (DerSequence, DerInteger, DerBitString,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Crypto/Util/asn1.py", line 27, in
from Crypto.Util.number import long_to_bytes, bytes_to_long
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Crypto/Util/number.py", line 399
s = pack('>I', n & 0xffffffffL) + s
^
SyntaxError: invalid hexadecimal literal

@ZhouXiaoLiu
Copy link

我也是这个问题,楼主目前解决了吗

@ZhouXiaoLiu
Copy link

这个错误是因为在代码中使用了Python 2的旧的语法,在Python 3中会导致语法错误。

在Python 2中,整数字面值后面的L用于指示长整数(long integer)。而在Python 3中,整数字面值不再需要后缀L来表示长整数。因此,在这个代码片段中,0xffffffffL应该被简化为0xffffffff。
说白了这个三方库用的py2语法,也不知道为啥标注的用的python3环境,这个项目可能老久没有维护了,要用得靠自己改了

@qingyuchan
Copy link

所有的Crypto删除,重新安装下pycryptodome库

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