nondanee / vsc-netease-music

UNOFFICIAL Netease Music extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=nondanee.vsc-netease-music
MIT License
1.02k stars 80 forks source link

Script Error: File "<stdin>", line 61, AttributeError: 'NoneType' object has no attribute 'group' #104

Closed TENX-S closed 3 years ago

TENX-S commented 4 years ago

macOS 10.15.5 Python 3.8.2

$ curl https://gist.githubusercontent.com/nondanee/f157bbbccecfe29e48d87273cd02e213/raw | python

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3304  100  3304    0     0   1065      0  0:00:03  0:00:03 --:--:--  1065
vscode 1.48.2 x64
Traceback (most recent call last):
  File "<stdin>", line 61, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
nondanee commented 3 years ago

https://gist.github.com/nondanee/f157bbbccecfe29e48d87273cd02e213#file-helper-py-L60 seems raw.githubusercontent.com is blocked

TENX-S commented 3 years ago

将第60行改写为f-string格式化字符串后可解决问题:

yarnrc = urllib.urlopen(f'https://raw.githubusercontent.com/Microsoft/{vscode_version[0]}/.yarnrc').read().decode()
nondanee commented 3 years ago

只是换个写法,为啥能解决问题?

TENX-S commented 3 years ago

确实只是写法换了,我试了很多次,原先的str.format()会报错,换成f-string就正常了。 原因不知,可能是个例吧。