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

TypeError: cannot use a string pattern on a bytes-like object 问题 #1

Open
secgithub opened this issue Jan 15, 2021 · 1 comment
Open

Comments

@secgithub
Copy link

issue1:

[09:54:07] [] Analyze .git/HEAD
None
Traceback (most recent call last):
File "git_extract.py", line 300, in
Git.git_init()
File "git_extract.py", line 289, in git_init
self.git_head()
File "git_extract.py", line 167, in git_head
refs = re.findall(r'ref: (.
)', head, re.M)
File "C:\Python\Python38\lib\re.py", line 241, in findall
return _compile(pattern, flags).findall(string)
TypeError: cannot use a string pattern on a bytes-like object

解决方法:

import chardet # modified

line 167: def git_head(self):
head = self.download_file('HEAD')
encode_type = chardet.detect(head) # modified
head = head.decode(encode_type['encoding']) # modified

貌似是python2 到python3的问题

issue2

python3 下urllib2被urllib.request 取代了
utils.py 中没改,python38下运行会有问题,替换完就好了

@gakki429
Copy link
Owner

暂时没有支持python3,抱歉

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

2 participants