Vscode pylint reported an error of “no member”, but it is running normally

Problem: 
Pylint Error Message: “E1101: Module 'xxx' has no 'xxx' member'”.
pylint no member issue but code still works in vscode

Python Python syntax checker for vscode

 

Pylint is static check . When using a third-party library, some members will be created only when the code is running, and it can’t find members

Solution:
using pylint Django to enhance pylin int steps

    1. install pylint Django
$ pip3 install pylint-django

Use pylint-django in vscode‘s setting.json for pylint-django</code

"python.linting.pylintArgs": [
    "--load-plugins",
    "pylint_django"
]
      1. restart VSCode

linux Ubuntu Error: No command ‘setenv‘ found

 

Linux Ubuntu error: no command ‘setenv’ found

 

Foreword solution


preface

   sometimes the installed software commands are written based on CSH. If you use bash to use the software, you will report an error, such as “no command ‘setenv’ found”. At this time, you need to change the default bash of Ubuntu to CSH

resolvent

   Linux Ubuntu changes the default bash to CSH by default

How to Solve Error: “Hdaudio hdaudioc0d2: unable to bind codec”

recently, after installing nidia drivers on the platform of Ubuntu 18.04, restart the computer, report the error “hdaudio hdaudioc0d2: unable to bind codec” on the command line, and the startup interface stays in the shell interface</ font>

note: there are many solutions to this problem on the Internet, but they don’t talk about the permission problem. The pro test can only save the modified grub file under the permission of root

resolvent

1. Enter super user root:

sudo -i

2. Enter grub file:

vim /etc/default/grub

3. Modify the following contents: before modification: </ font> </ font> 1

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

Modify:

GRUB_CMDLINE_LINUX_DEFAULT=""

4. Save the file: </ font> </ font>

ESC +:x

Spark ERROR client.TransportResponseHandler: Still have 1 requests outstanding when connection from

The spark task reports an error (though the calculated result is correct).

21/04/29 14:38:38 ERROR client.TransportResponseHandler: Still have 1 requests outstanding when connection from /172.16.4.156:37528 is closed
21/04/29 14:38:39 ERROR cluster.YarnScheduler: Lost executor 3 on cdh-slave1.test.com: Container marked as failed: container_1618397085347_0529_01_000004 on host: cdh-slave1.test.com. Exit status: 137. Diagnostics: [2021-04-29 14:38:39.112]Container killed on request. Exit code is 137
[2021-04-29 14:38:39.117]Container exited with a non-zero exit code 137.
[2021-04-29 14:38:39.119]Killed by external signal

Looking at the code, I found that hive is not used in the spark program, but hive support is set during spark initialization.

The program works fine after deleting this line of code.

Python IndexError: too many indices for array: array is 1-dimensional, but 2 were i..

This is the reason why there are empty tags in the XML files in the dataset.
first of all, what are empty Tags:
& <zhoz>& </ zhoz> this form, that is, there is no value in it
normal should be & < zhoz> 56 this form

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
# Move the xml with empty tags and move the corresponding images synchronously
import os
import xml.etree.ElementTree as ET
import shutil
 
origin_ann_dir = '/home/data_1/project/big-obj/RefineDet.PyTorch/data/VOCdevkit/VOC2007/Annotations/'# Set the original tag path to Annos
new_ann_dir = '/home/data_1/project/big-obj/RefineDet.PyTorch/data/VOCdevkit/VOC2007/xml-save/'# Set the new tag path Annotations
origin_pic_dir = '/home/data_1/project/big-obj/RefineDet.PyTorch/data/VOCdevkit/VOC2007/JPEGImages/'
new_pic_dir = '/home/data_1/project/big-obj/RefineDet.PyTorch/data/VOCdevkit/VOC2007/pic-save/'
k=0
p=0
q=0
for dirpaths, dirnames, filenames in os.walk(origin_ann_dir):  
  for filename in filenames:
    print("process...")
    k=k+1
    print(k)
    if os.path.isfile(r'%s%s' %(origin_ann_dir, filename)):   # get the absolute path to the original xml file, isfile() detects if it is a file isdir detects if it is a directory
      origin_ann_path = os.path.join(r'%s%s' %(origin_ann_dir, filename)) # If yes, get absolute path (repeat code)
      new_ann_path = os.path.join(r'%s%s' %(new_ann_dir, filename))
      tree = ET.parse(origin_ann_path)  
      root = tree.getroot()   
      if len(root.findall('object')):
        p=p+1
      else:
        print(filename)
        old_xml = origin_ann_dir + filename
        new_xml = new_ann_dir + filename
        old_pic = origin_pic_dir + filename.replace("xml","jpg")
        new_pic = new_pic_dir + filename.replace("xml","jpg")
        q=q+1
        shutil.move(old_pic, new_pic)
        shutil.move(old_xml, new_xml)
print("ok, ",p)
print("empty, ",q)

Found the XML file that generated the empty tag. The contents are as follows:

<annotation>
	<folder>obj1344</folder>
	<filename>obj1344_frame0000172.jpg</filename>
	<path>D:\Research\valid\obj1344\obj1344_frame0000172.jpg</path>
	<source>
		<database>Unknown</database>
	</source>
	<size>
		<width>480</width>
		<height>270</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
</annotation>

After the XML file is found, the image needs to be annotated again. After opening labelimg to annotate the data, the content of the XML file is as follows:

<annotation>
	<folder>JPEGImages</folder>
	<filename>obj1344_frame0000172.jpg</filename>
	<path>D:\new\SSD-master\datasets\VOC2007\JPEGImages\obj1344_frame0000172.jpg</path>
	<source>
		<database>Unknown</database>
	</source>
	<size>
		<width>480</width>
		<height>270</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>plastic</name>
		<pose>Unspecified</pose>
		<truncated>1</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>181</xmin>
			<ymin>144</ymin>
			<xmax>355</xmax>
			<ymax>270</ymax>
		</bndbox>
	</object>
	<object>
		<name>timestamp</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>10</xmin>
			<ymin>5</ymin>
			<xmax>471</xmax>
			<ymax>43</ymax>
		</bndbox>
	</object>
	<object>
		<name>timestamp</name>
		<pose>Unspecified</pose>
		<truncated>1</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>14</xmin>
			<ymin>216</ymin>
			<xmax>480</xmax>
			<ymax>270</ymax>
		</bndbox>
	</object>
</annotation>

Modify and replace the original XML file to run.

Prompt unknown error in pom.xml of Maven project

Today, we learn how to build a spring cloud foundation project. Pom.xml file prompts unknown error exception.

Try to solve the problem: I prefer to rely on Maven project and check whether the jar package that Maven project relies on is downloaded to the local warehouse normally, but none of them solve the problem.

After Googling, I found that many students met this situation, and I also found the cause of the problem.

Cause of the problem: there is a conflict between the spring boot version of Maven project and the Maven jar plugin version.

Solution version: reduce Maven jar plugin version

Pom.xml instance:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.zzg</groupId>
	<artifactId>cx-cloud</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>pom</packaging>

	<description>CX-Cloud:Microservice Rights Management System</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.4.4</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>

	<!--set the version -->
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.8</java.version>
		<spring-boot.version>2.4.4</spring-boot.version>
		<spring-cloud.version>2020.0.2</spring-cloud.version>
		<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven-jar-plugin.version}</version>
			</dependency>
		</dependencies>

	</dependencyManagement>


	<modules>
	<module>cx-commons</module>
	<module>cx-common</module>
	<module>cx-auth</module>
	<module>cx-server</module>
	</modules>
</project>

Note: the point is to specify the Maven jar plugin version in the properties version tab

How to Solve Python Xlwt ValueError: More than 4094 XFs (styles)

Solution

For style setting functions:

def define_style():
    font = xlwt.Font()
    font.colour_index = 1
    my_style = xlwt.XFStyle()
    my_style.font = font  
    return my_style

When writing data, do not use sheet.write (0, 0, 'data', define)_ Style ()) in this way, change to:

mystyle = define_style()
sheet.write(0, 0, 'data', mystyle)

Example analysis

The following code will report an error

import xlwt


def define_style():
    font = xlwt.Font()
    font.colour_index = 1
    my_style = xlwt.XFStyle()
    my_style.font = font 
    return my_style


if __name__ == '__main__':
    book = xlwt.Workbook(encoding='utf-8')
    sheet = book.add_sheet('sheet1', cell_overwrite_ok=True)
    # mystyle = define_style()
    for i in range(10000):
        sheet.write(i, 0, u'(0,0)', define_style())  
    book.save('my_excel.xlsx')

Modify the part in main function as follows:

	mystyle = define_style()
	for i in range(10000):
        sheet.write(i, 0, u'(0,0)', mystyle)  

Reason analysis

When using xlwt to write data, when passing in the style of xfstyle format, do not use anonymous function to call to write, otherwise after writing 4094 data, it will exceed the threshold, and an error will be reported: valueerror: more than 4094 XFS (styles)

Error: linker ` link. Exe ` not found | = note: the system cannot find the specified file.

Error: linker ` link. Exe ` not found | = note: the system cannot find the specified file. (os error 2)”
PS C:\Users\sun\Desktop\runoob-greeting> cd .\greeting
PS C:\Users\sun\Desktop\runoob-greeting\greeting> cargo build
Compiling greeting v0.1.0 (C:\Users\sun\Desktop\runoob-greeting\greeting)
error: linker link.exe not found|= note: The system could not find the specified file. (os error 2)
note: the msvc targets depend on the msvc linker but link.exe was not found
The problem occurs in the context of: Rust’s build tools and package management tools – Cargo

Solution.
Install Visual Studio 2019 build tools Visual Studio 2019 build tools or Microsoft Visual Studio. after downloading build tools, in Visual studio installer select only ” C++ build tools”, then select only “MSVC v142 – VS2019 C++ x64/x86 build tools”.

U-boot NFS download file error: loading: * * * error: File lookup fail solution

The reason for this error is:
the version of NFS used in uboot is V2, while the version of NFS used in Ubuntu is V3, V4 and above. As a result, uboot can no longer find files in the NFS server.

The solution is to make NFS in buntu compatible with v2. Modify the /etc/default/NFS kernel server file.

Open the file: sudo VIM/etc/default/NFS kernel server (note that sudo or root permissions are required), and modify it as follows:

# Number of servers to start up
RPCNFSDCOUNT=" -V 2 8"

# Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0

# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information, 
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="-V 2 --manage-gids"

# Do you want to start the svcgssd daemon?It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=""

# Options for rpc.svcgssd.
RPCSVCGSSDOPTS="--nfs-version 2,3,4 --debug --syslog"

Restart the NFS server. sudo service nfs-kernel-server restart