Don't worry, be happy.

2019-06-12
Suppress pylint errors in vscode

pylint is a useful tool to debug python in vscode, however, it keeps report errors on some unknown packages that are not available in my local environment, such as following codes

1
2
3
4
if local:
import a1
else:
import a2

pylint will keep report unable to import a2. After google around, I found a work around to fix this problem, just add following settings in user setting json file for vscode:

1
2
3
4
5
"python.linting.pylintArgs": [
"--errors-only",
"--generated-members=numpy.* ,torch.* ,cv2.* , cv.*",
"--ignored-modules=a2"
],

Then pylint will ignore a2 package errors.

Another bug of pylint is when using with torch or numpy, some functions cannot be found properly, such as torch.cat, above json can also suppress those errors.

Read More

2019-04-03
TIL python list assignment does not make new list!

Well, TIL python list just store the pointer to the actually list in memory. So simple list assignment does not make new list!

1
2
3
4
5
list_a = [1,2,3,4]
list_b = list_a
list_b[2] = 10
print(list_a)
print(list_b)
Read More

2019-03-14
TIL there a 3 types of Python programmer

  1. Use 2 spaces to indent.
  2. Use 4 spaces to indent.
  3. Use Tab to indent.

And they must hate each other.

Read More

2019-03-06
I found a girl

And I think this is it, she is the one.

Read More

2019-02-27
anaconda SSL module is not available

最近需要在windows上调试一下pytorch,想着用anaconda方便一些。跟着大部分教程安装完、配置了源,但是在安装pytorch的时候一直报错:SSL module is not available。同时anaconda的python直接运行import ssl也找不到ssl模块

1
2
3
4
5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: 找不到指定的模块。

百度和Google了一圈,才发现正确答案,就是添加anaconda环境变量到windows的时候需要添加3个:

1
2
3
C:\ProgramData\Anaconda3
C:\ProgramData\Anaconda3\Scripts
C:\ProgramData\Anaconda3\Library\bin

第三个没添加就会出现这个问题。

Read More