raise ValueError(‘Expected input batch_size ({}) to match target batch_size ({}).‘

raise ValueError(‘Expected input batch_ size ({}) to match target batch_ size ({}).’

Remember to print the size of the picture before forward propagation. I didn’t notice that all the pictures come in RGB three channel data this time. When using the . View function, I remember to look at it first. When I used it, I calculated the size of the picture directly according to a single channel. Generally, this is the phenomenon that the size of the picture does not match

The phenomenon of mating

Solve the problem that M1 Mac can’t debug when using GoLand

The general error information is as follows:

API server listening at: [::]:57824
debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1200.0.44
 for x86_64.
error: failed to launch process /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver: (os/kern) invalid argument
Exiting.

I use go 1.16, which supports arm architecture. The reason for this problem is that go debug needs DLV tool, which also needs arm architecture.

The easiest way to solve this problem is to go to the official website to update GoLand. Pay attention to go to the official website to download the latest arm version again. Usually, the update prompted in the IDE can only be regarded as a patch, not a big version update. In this way, the debugging tools of IDE are adapted to arm architecture.

Of course, due to various reasons that cannot be described, some users may not be suitable to go to the official website to update, so you can refer to this link   https://youtrack.jetbrains.com/issue/GO-10235#focus =Comments-27-4632451.0-0

Download the DLV debugging tool of arm architecture, and then configure it in IDE.

Create a new project in pycharm: modulenotfounde rror:No module named ‘distutils.util‘

The error is as follows:

Don’t panic. It’s not a big problem

When installing pycharm in the Ubuntu system and creating a new project, prompt

ModuleNotFoundError: No module named ‘distutils.util’

The reason is that Ubuntu 18.04 does not install PIP by default, so you need to install python3 pip,

Enter the command in the terminal:

sudo apt-get install python3-pip

When you create a new project again, the problem can be solved

When calling time module – time / datetime in wxPython, an error is reported. Valueerror: unknown locale: zh cn

1. Key words: valueerror: unknown locale: zh cn

A lot of instructions on the Internet are about the language environment. Set up a round down, or not.

2. Key words: wxPython valueerror: unknown locale: zh cn

We found the following link through the wall:

https://github.com/pyinstaller/pyinstaller/issues/4874

The corresponding relationship of the version number mentioned below

 
  PyInstaller==3.4 wxPython==4.0.4 good

  PyInstaller==3.6 wxPython==4.0.4 good

  PyInstaller==3.6 wxPython==4.0.7 good

  PyInstaller==3.6 wxPython==4.0.7.post2 good

  PyInstaller==3.6 wxPython==4.1.0 bad

 
3. Upgrade or reduce the version number of wxpathon. Then upgrade the version.

pip3 install upgrade wxPython

NettyAvroRpcClient RPC connection error

2014-12-19 01:05:42,141 (lifecycleSupervisor-1-1) [WARN – org.apache.flume.sink.AbstractRpcSink.start(AbstractRpcSink. java:294 )] Unable to create Rpc client using hostname: xxx.xxx.xxx.xxx, port: 41100
org.apache.flume.FlumeException: NettyAvroRpcClient { host: 121.41.49.51, port: 41100 }: RPC connection error

This problem occurs when flume uses Avro to accept data.

First, let’s see if the port of the connected server is monitored

If you want to send data to port 4383 of 192.168.1.1, you need a server listening to this window, otherwise RPC connection failure will occur

ERROR: Invalid HADOOP_COMMON_HOME

Error when starting Hadoop and yarn
/start yarn. Sh
error: invalid Hadoop_ COMMON_ HOME

Solution:
1. Check Java first_ Is home configured correctly

java
javac

2. Then check whether Hadoop home is configured correctly

hadoop version
Hadoop 3.1.3
Source code repository https://gitbox.apache.org/repos/asf/hadoop.git -r ba631c436b806728f8ec2f54ab1e289526c90579
Compiled by ztang on 2019-09-12T02:47Z
Compiled with protoc 2.5.0
From source with checksum ec785077c385118ac91aadde5ec9799
This command was run using /opt/module/hadoop-3.1.3/share/hadoop/common/hadoop-common-3.1.3.jar

When generating a test report in HTML format, report [typeerror: a bytes like object is required, not ‘STR’]

1、 Error information

E:\pythonProject\study\venv\Scripts\python.exe E:/pythonProject/case/test_ login.py
…Traceback (most recent call last):
  File “E:\pythonProject\case\test_ login.py”, line 71, in < module>
    runner.run(suit)  # Call the run() method under the htmltestrunner class to run the use case suite
class   File “E:\pythonProject\study\venv\lib\site-packages\HTMLTestRunner\HTMLTestRunner.py”, line 631, in run
    self.generateReport(test, result)
  File “E:\pythonProject\study\venv\lib\site-packages\HTMLTestRunner\HTMLTestRunner.py”, line 691, in generateReport
    self.stream.write(output)
TypeError: a bytes-like object is required, not ‘str’

2、 Source code

#Path and name of test report

dir = “E:/pythonProject/login_ report.html”

#”WB” creates or opens a binary file and writes the finished data

filename = open(dir, “wb”)

#Call htmltestrunner class to define test report content

runner = HTMLTestRunner.HTMLTestRunner(stream=filename, title=”Testcase Report”, description=”testcases”)

runner.run(suit)     #  Call the run () method under the htmltestrunner class to run the use case suite

filename.close()    #  Close test report file

3、 Solutions

#Path and name of test report

dir = “E:/pythonProject/login_ report.html”

#”W” creates or opens a new file and writes the finished data

filename = open(dir, “w”)

#Call htmltestrunner class to define test report content

runner = HTMLTestRunner.HTMLTestRunner(stream=filename, title=”Testcase Report”, description=”testcases”)

runner.run(suit)     #  Call the run () method under the htmltestrunner class to run the use case suite

filename.close()    #  Close test report file

ModuleNotFoundError: No module named xxx

Background: I encapsulate a package and contain multiple sub packages. Each sub package has multiple different moodles. When I refer to moodles again, it is OK to run in pychar. However, when I put this folder in Linux, there is an error: modulenotfounderror: no module named ‘package’  。
The structure is as follows:

package:

    ├─ sub_package0

        │ ├─ __init__.py

        │ ├─ utils.py

        │ └─ www.py

    ├─ sub_package1

        │ ├─ __init__.py

        │ ├─ utils1.py

        │ └─ www1.py

    ....

    ├─ __init__.py

    ├─ abc.py

    └─ xyz.py

After online Baidu, mainly tried two methods:

(1) One is to add environment variable pythonpath in. Bashrc of Linux environment http://blog.sina.com.cn/s/blog_ 9b1b494a0102vrl3.html

(2) In each moudule, add a path through the sys module https://www.cnblogs.com/dreamyu/p/7889959.html

After trying the first method, we found that the above error was still reported, while the second method was too cumbersome because it had to be added to each module. In order to save trouble, put the package directly into anaconda3’s installation path anaconda3/lib/python3.6/site-packages, and the problem is solved. The site packages library is actually the storage location of the package and module installed by PIP install.

 
Supplementary knowledge

Module: module. A. Py file can be called a module. Using module can avoid the conflict between function name and variable name. Functions and variables with the same name can be stored in different modules, but it should also be noted that the names of built-in functions should not conflict with each other.

Package: package. Different modules are organized by directory, similar to folder. Modules are organized by package to avoid conflicts. After the package is introduced, as long as the top-level package name does not conflict with others, all modules will not conflict with others. Please note that there is a under each package directory__ init__. Py file, this file must exist, otherwise, python will regard this directory as a normal directory instead of a package__ init__. Py can be an empty file or have Python code, because can be an empty file__ init__. Py itself is a module, and its module name is its package name.