Author Archives: Robins

Python requests Error: ConnectionError: (‘Connection aborted.‘, error(104, ‘Connection reset by peer‘))

Python requests error

ConnectionError: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))

There are two possible causes

1. Requests are too frequent, resulting in requests being rejected

Solution:

Set a sleep time for each request, such as
time sleep(1)

2. The interface has authentication or anti crawling mechanism. It is recognized that it is accessed by Python terminal, and the access is rejected

Solution:

Set user agent in request header to bypass authentication

as

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',"Content-Type": "application/json"}

SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: truncated \UX

Cause analysis: Python \ has the meaning of escape, so the read path is wrong

import os
os.walk('C:\Users\user\Desktop\Test')

Solution:
1. Add r in front of the path to prevent character escape.

import os
os.walk(r'C:\Users\user\Desktop\Test')

2. Use a double diagonal bar to read and output a backslash

import os
os.walk(r'C:\\Users\\user\\Desktop\\Test')

Error creating bean with name ‘adminMapper‘ Injection of resource dependencies failed

Project scenario:

springboot project, unable to create bean object and inject dependency


Problem Description:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'adminService': 
 Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 
'adminMapper' defined in file [E:\IdeaCode\toyrentalplatform\target\classes\cn\gestwr\toy\dao\AdminMapper.class]: Unsatisfied dependency expressed through bean property 
'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException:

Cause analysis:

It is the configuration file application Properties


Solution:

the configuration options of the configuration file are wrong, for example, the following configuration is added and an error is reported

mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

In the properties file, the color of this configuration is different from that of other configurations. The correct one is light green

Note the format of the YML configuration file

[Solved] Invalid signature error for ROS repository while trying to do sudo apt-get update

After installing ROS in Ubuntu system, the apt-get update command reports an error:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.ros.org/ros/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected]>
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease  Could not resolve 'dl.google.com'
W: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/bionic/InRelease  The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected]>
W: Failed to fetch http://packages.microsoft.com/repos/code/dists/stable/InRelease  Could not resolve 'packages.microsoft.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Solution:
we have to re-add the mentioned GPG key to the system by using command below

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

[Solved] ROS fatal error: alsa/asoundlib. h: There is no such directory or file

Ubuntu18. 04 + catkin for ROS melody_Make compile robot_Voice, the error message is as follows:,

Scanning dependencies of target iat_publish
[ 12%] Building CXX object robot_voice/CMakeFiles/iat_publish.dir/src/iat_publish.cpp.o
[ 25%] Building C object robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
/home/mc/ros/vision/src/robot_voice/src/linuxrec.c:12:10: fatal error: alsa/asoundlib.h: 没有那个文件或目录
 #include <alsa/asoundlib.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
robot_voice/CMakeFiles/iat_publish.dir/build.make:110: recipe for target 'robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o' failed
make[2]: *** [robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o] Error 1
CMakeFiles/Makefile2:449: recipe for target 'robot_voice/CMakeFiles/iat_publish.dir/all' failed
make[1]: *** [robot_voice/CMakeFiles/iat_publish.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

Solution:

sudo apt-get install libasound2-dev

Or

sudo yum install alsa-lib-devel

[Solved] error in REfO setup command: use_2to3 is invalid.

Problem Description: When using pip command to install refo==0.13 version, it will show that it is installed as 0.12 version because 0.13 version only has .tar.gz file and no whl file, pip installation will select 0.12 version, while manually downloading 0.13 version .tar.gz file and installing offline, it will report an error, the following is the process of the problem.

Requirement: install refo==0.13 version

pip install refo
#It will automatically install 0.12, because 0.13 does not have xhl files

pip install refo==0.13
#Error in REfO setup command: use_2to3 is invalid.
error in REfO setup command: use_2to3 is invalid.

# Download the 0.13 .tar.gz file and install it offline with the same error.
error in REfO setup command: use_2to3 is invalid.

Check the data and the problem is:

setuptools>= 58 interrupt support use_2to3

Setuptools change log for V58

setuptools should be updated to setuptools<Version 58 or avoid using use_2to3 set the package in the parameters.

Solution: Execute the following command:

pip install setuptools==56.0.0
#After execution, setuptools will automatically fall back to version 56.0.0

Then just install the refo==0.13 version.tar.gz file offline

Supplement the contents of the third-party package for offline installation:

Python third-party library download website Python third-party library

.whl file installation.

Go to the directory of the above whl file from the command line interface in one of the environments under anaconda where the library needs to be installed
Install the library using the command: pip install xxxxx.whl
.tar.gz file installation.

From the command line interface, go to the above extracted directory in the environment where the library is to be installed under anaconda
Use the command: python setup.py install

How to Solve Chrome Error: “ERR_HTTP2_PROTOCOL_ERROR”

Practical application items: http://github.crmeb.net/u/long

Solution:

  • open chrome://flags/ page
  • find Block insecure private network requests. and Enable Trust Tokenstwo
  • Change its value from Default to Enable
  • Click the ReLaunch button restart the browser
  • Reopen the website that reported the error
  • If it doesn’t open, enter chrome://restart/ it in the address bar and restart the browser.

[Solved] Node.js: Error: connect ECONNREFUSED ::1:3306

Use node JS database module MySQL , connection database query error

Error: connect ECONNREFUSED ::1:3306

reason

I annotated the mapping relationship of /ECT/hosts

# 127.0.0.1   localhost

The original configuration used localhost , so the database could not be connected suddenly

{
  host: 'localhost',
  user: 'root',
  password: '123456',
  database: 'data',
};

Treatment method

Method 1:

Change the mapping relationship of /ECT/hosts

# 127.0.0.1   localhost
127.0.0.1   localhost

Method 2:

You can use 127.0.0.1 instead

{
  // host: 'localhost',
  host: '127.0.0.1',
  user: 'root',
  password: '123456',
  database: 'data',
};

[Solved] Error response from daemon: driver failed programming external connectivity on endpoint mymysql

docker: Error response from daemon: driver failed programming external connectivity on endpoint mymysql (59ba4bda46b12a5ac9d20e021d9393e518542ac724c1dc8e5b0a524072513087): (iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 3306 -j DNAT –to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.

Solution:

systemctl stop firewalld
systemctl restart docker