Tag Archives: bug

Modulenotfounderror: no module named ‘CV2’ – (version problem)

Ubuntu Running OpenCV project tip: ModuleNotFoundError: No Module Named ‘Cv2’
Haha, that was the problem when it was first installed. Just throw me up.
1. Reason: the versions are inconsistent
The problem is that when installing OpencV-Python, the detailed version number is appended, which makes it different from the Python environment. In addition, there will be other problems, I can’t remember exactly.
2. Solutions

    first use the instruction: PIP install opencv-python to execute once, if the .py file or so to see the next one; Just do not append the version number when installing OpencV-Python.

Index error: invalid index to scalar variable

IndexError: invalid index to scalar variable.
invalid index
generally appears in the np array index error
Here are some examples:

    a = np.array([[1, 2], [3, 4], [5, 6]])
    print(a[0][0][1])

After running, report an error:

IndexError: invalid index to scalar variable.

Therefore, when the above error occurs, we should check whether the index is wrong, such as the original two-dimensional array, using three levels of index.

BUG: Bad page map in process XXX pte:800000036fae6227 pmd:35be8c067

First of all, given the kernel printing information, the serial port will have some, dmesg will see a little bit more.

BUG: Bad page map in process XXX pte:800000036fae6227 pmd:35be8c067
addr:00007f3fa75c0000 vm_flags:00200070 anon_vma:(null) mapping:(null) index:7f3fa75c0
Pid: 1312, comm: XXX Not tainted 2.6.32.27 #1
Call Trace:
 [<ffffffff815a3570>] print_bad_pte+0x1e2/0x1fb
 [<ffffffff811063ee>] vm_normal_page+0x6e/0x80
 [<ffffffff81107117>] unmap_vmas+0x5b7/0x9f0
 [<ffffffff8106edba>] ?dequeue_signal+0xda/0x170
 [<ffffffff8110cb5c>] unmap_region+0xcc/0x170
 [<ffffffff8110e405>] do_munmap+0x305/0x3a0
 [<ffffffff8110f183>] sys_munmap+0x53/0x80
 [<ffffffff8100c082>] system_call_fastpath+0x16/0x1b
Disabling lock debugging due to kernel taint

Don’t worry about the kernel version number on the stack, because switching to a 3.16.44 kernel will also cause this problem.
The stack seemed to provide a lot of information, but not much help in locating the problem, and at one point led in the wrong direction.
Stack analysis: this stack is obviously a system call, the interface function of the system call is munmap(), in the program code search, only find a few, the analysis of the code seems to see nothing wrong. So in the process to hang up the point, since the stack each time appears in the business thread, so all the business threads in munmap() hang the breakpoint: break munmap thread idx, and then break munmap thread idy… Not every time a breakpoint is triggered, the stack will be triggered several times before it occurs. This phenomenon began to suspect that the kernel memory problem. Until a display *(0x00007f3fa75c0000) is set, each time the munmap() breakpoint is triggered, an attempt is made to read the value of *(0x00007f3fa75c0000). After an interrupt is triggered, The stack above is printed directly (without setting display, continue and munmap() triggers printing), which is more certain that there is a kernel memory problem.
In the first believe the kernel, doubt their own mentality, the first location of the driver problem, the first thought is netmap driver. View process XXX memory map: cat /proc/1312/maps

...
7f4020021000 default
7f40275c0000 default file=/dev/Vnetmap
7f40a8000000 default anon=3 dirty=3 N0=3
7f40a8021000 default
...

Any surprise to find that 0x7f40275c0000-0x00007f3fa75c0000 = 0x80000000, which is netmap minus the mapping address of the problem (that’s the one on the top display) is equal to 2G. Every time. One face muddleheaded, think of this matter what mechanism caused by the kernel, then walked to read the kernel memory management code, focused on the mmap() system call flow. I’ll probably think about it first. mmap() system call flow is simple as follows:

do_mmap_pgoff
   |
   |--get_unmapped_area
   |--...
   |--mmap_region
        |
        |--find_vma_repare
        |--...
        |--file->f_op->mmap
        |--...

The above file - & gt; f_op-> Mmap is specific to the file function, also note the above device file /dev/Vnetmap when the user program opens it and puts its file descriptor fd to mmap() then it can be tuned to Vnetmap custom file-> f_op-> Mmap . He is in the Vnetmap driver implementation, the problem is here.
Analysis: The running environment is 64-bit X86 platform. Vnetmap is the driver module, running in kernel state, it maps the memory applied in the kernel bit by bit to the user virtual address space. It USES a variable of type int as the cumulative count of the virtual address offset, after the offset exceeds 2G, int has a sign flip and becomes negative, and the offset becomes -2g , which seems to be associated with the above.
Understand: (this part didn't source, pure analysis is only for convince yourself that it is not much time, but also does other, have the time to analyze) beyond 2 g memory of kernel space, actual associated with a page table (error), but not visible in the area of the page (eara), errors associated with user mode space is redistributed, find a page table is associated with the page frame, print the above error.


Contact: [email protected]

Python packaged *. Exe is running os.popen (cmd)/ subprocess.Popen *. Exe crashes with invalid [winerror 6] handle

Summary of the problem: last week I used Python3.8.5 to write an upgrade script for a software running on Windows 7, and by printing and exception catching found that the script crashed when the script was executed to os.popen(CMD), the exception was [WinError 6] handle invalid

Part of the test code:

logging.info('__Start__')
logging.info('os.system1')
logging.info('os.popen1')
try:
    logging.info(os.popen('c:'))
    logging.info('os.popen2')
except Exception as a:
    logging.info(a)
    logging.info('os.popen3')
logging.info('os.popen4')

Effect :

After testing, it was found that the program and script could run normally on Win10, and the script was executed separately on Win7 without any problem, and the script was called with the program on Win7, even if the script was executed OS.popen (‘ c: ‘) would crash.

Because os.popen is actually the encapsulation of subprocess.Popen, so the title also carries subprocess.Popen
solution: to implement a function myPopen, or use subproce. popen0 will be 1 stdin = Subprocess. DEVNULL to modify, the code is as follows:

def myPopen(cmd):
    proc = subprocess.Popen(cmd,
                            shell=True,
                            stdout=subprocess.PIPE,
                            stdin=subprocess.DEVNULL)
    return proc.stdout.read().decode()

Python running as Windows Service: OSError: [WinError 6] The handle is invalid
Popen(

LIBGL error: no matching fbconfigs or visual s found

Installing or updating the Nvidia driver may cause the libGL dynamic link library link to break or point to the wrong link. During make compilation, the following Bug prompts generally occur:

Solution steps:
1. Swrast is mainly used for graphics rendering, and the problem description does not find the hardware driver of the graphics card. The installed libGL libraries and the links to these libGL libraries can be passed
Sudo find/usr-iname “* libgl.so *” -exec ls-{} \;
In general, updating or installing video drivers breaks these links, especially /usr/lib/ x86_64-Linux-gnu /mesa/ libgl.so.1.2.0 sometimes breaks the links
Or pointing to the wrong link
2. For the problem of 1, libgl.so.1.2.0 points to the correct opengL library: sudo ln-s /usr/lib/ libgl.so.1 /usr/lib/x86_64-linux-gnu/mesa/ libgl.so.1.2.0
When recompiling make, the Bug is solved and the classic fireworks dynamic diagram appears

“Error: a JNI error has occurred” and “error of” jvm.cfg To solve the problem

Today in the CMD environment

java Helloworld.java
javac Helloworld

If it doesn’t work, it shows up

Exception in thread "main" java.lang.UnsupportedClassVersionError: helloworld has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Error message.
after thinking about it, I probably made a java8 environment by playing mine craft before. Later, I downloaded and installed jdk13 for development, which caused the problems caused by the difference between javac and Java version.
then reset JAVA_HOME to C:\Program Files\Java\jdk-13 should be solved.
when something weird happens, still report this error. In a rage, I deleted
and reported an error after I deleted
directory
which caused the conflict

Error: could not open `C:\Program Files\Java\jre1.8.0_201\lib\amd64\jvm.cfg

The problem should be clear, because I don’t know which environment variable is still pointing to this folder, I find the same problem in stackoverflow, where Jason Hughes mentioned that this guideline exists in C:\Program Files\Common Files\oracle\ folder, (my word is C:\Program Files(x86)\Common Files\oracle\), delete the directory directly and restart once it comes.
problem solved.

Eclipse .java File Syntax error, parameterized types are only available if source level is 1.5 or

Error in Eclipse. Java file:
Syntax Error, Parameterized Types are only available if source level is 1.5 or greater
This is a compiler version of the problem, the solution:
1. Right click project –& GT; Properties–> Java Compiler–> Remove the Use Compliance from Executeion Enveronment · check box, and change Compiler ·· to more than 1.5

2, Windows – & gt; preferneces–> JAVA–> compiler–> The window on the right “Compiler Compliance level” is set to more than 1.5

(Emitted value instead of an instance of Error) Error compiling template:

Conclusion: Find out if templent contains a script and remove it
Error: (Emitted value instead of an instance of Error)
Error compiling. template:
also has a paragraph Error:
Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as

Reason: Error packaging vUE with elementUI for the first time