Author Archives: Robins

[Solved] Python Using or importing the ABCs from ‘collections‘ instead of from ‘collections.abc‘ is deprecate

python Import Warning: Using or importing the ABCs from ‘collections’ instead of from ‘collections.abc’ is deprecated since Python 3.3, and in 3.10 it will stop working
Codes below:

from collections import Iterator

print(isinstance(iter([]), Iterator))  # True

# Console output:
# D:\Code_data\pycharm project\first test\08-iterable.py:2: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
#   from collections import Iterator
# True

Although the results have come out, there has always been an annoying warning (using or importing the ABCs from ‘collections’ instead of from’ collections. ABC ‘is predicted since Python 3.3, and in 3.10 it will stop working), The solution is to change
from collections import iterator
to
from collections.abc import iterator

[Solved] Some chunks are bigger warning on vite packaging

Solution:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
	plugins: [vue()],
	build: {
		rollupOptions: {
			output: {
				//Solve Warning: Some chunks are larger
				manualChunks(id) {
					if (id.includes('node_modules')) {
						return id.toString().split('node_modules/')[1].split('/')[0].toString();
					}
				}
			}
		}
	}
})

The problem that the El icons icon cannot be displayed in vue3 + element plus + vite

The problem that the El icons icon cannot be displayed in vue3 + element plus + vite

Recently, I used the new vue3 + element plus to do front-end project exercises. Using the latest vite, I found that the icons of element can’t be displayed. According to the usage in the official documents, other components can be displayed normally, but the icons can’t be displayed. I asked several front-end leaders of the company that they hadn’t used these new things, Baidu couldn’t find a solution after a long time, so it had no choice but to go to GitHub of vite and finally found that

it was the version problem of vite, so switching vite version can display icons normally

After several years of Java, I found the answer in GitHub for the first time, which was the front end… It can only be said that the pits of java have been trampled by the predecessors

module ‘win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9‘ has no attribute ‘CLSIDToClassMa

Using win32com encountered the following bug

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\win32com\client\gencache.py", line 534, in EnsureDispatch
    mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], bForDemand=bForDemand)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\win32com\client\gencache.py", line 391, in EnsureModule
    module = GetModuleForTypelib(typelibCLSID, lcid, major, minor)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\win32com\client\gencache.py", line 266, in GetModuleForTypelib
    AddModuleToCache(typelibCLSID, lcid, major, minor)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\win32com\client\gencache.py", line 552, in AddModuleToCache
    dict = mod.CLSIDToClassMap
AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'CLSIDToClassMap'

The solution is:
delete the following folder, and the program can run normally

C:\Users\<my username>\AppData\Local\Temp\gen_py

‘coroutine‘ object is not iterable [How to Solve]

ValueError: [TypeError("'coroutine' object is not iterable"), TypeError('vars() argument must have __dict__ attribute')]

In fastapi, uvloop uses asynchronous function
to use asynchronism. ‘coroutine’ object is not Iterable error
originally found that asynchronous code was called in synchronous function.

Please add async, await to the external function

Method of getting app. Config. Globalproperties. X directly from vue3

Suppose we define a global method in main. JS

//main.js

 app.config.globalProperties.$hello = name => {
      console.log('hello ' + name)
 }

Call this method in other pages.

//other.js

import { getCurrentInstance } from "vue";
const { appContext } = getCurrentInstance();

const callHello = ()=>{
 appContext.config.globalProperties.$hello('jay');
}

callHello()
//'hello jay'

Error: permission denied (public key, GSSAPI keyex, GSSAPI with MIC, password)

1、 Background

Due to the need of work, I installed and deployed a Jenkins, and configured a job for a project. Among them, you need to SSH from Jenkins machine to other remote machines to solve the problem of wrong report!!!

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

2、 Solutions

Baidu online meal, basically are wrong answers. In fact, it is because there is no configuration of password free login, so let the operation and maintenance colleagues help to do the password free login between servers, the result is still not good!!! Finally, after the guidance of my colleagues, I found that my Jenkins was started with jboss5, so my password free permission should also be jboss5 permission, but the actual operation and maintenance colleagues helped to do root permission, so the above error was not solved.

Reconfiguring jboss5’s password free login is OK

No module named sklearn.neighbors_ typedefs

An error occurred during the execution of the EXE file generated by pyinstall package

no module named sklearn.neighbors_typedefs

Solution

Delete the original dist, build file and spec file, and add:

python pyinstaller.py -F -c xxx.py --hidden-import sklearn.neighbors.typedefs

For example:

python pyinstaller.py -F device_data_collect.py -p src --hidden-import sklearn.neighbors.typedefs

Postscript

[postscript] in order to enable everyone to learn programming easily, I created a public official account, which includes programming for quick learning, and some dry cargo to improve your programming level. There are also some programming projects suitable for some courses design.

You can also add my wechat [1257309054] to bring you into the group and let us exchange and study together

Focus on me, we grow together~~