# Error when manipulating files: zipfile.BadZipFile: File is not a zip file

When writing code, the recorder pursues decoupling, and wants the program to see if the path file exists. The OS module is usually used to operate the file or path. If it does not exist, the file is created under the current path for subsequent operations. As far as I know, the OS module does not give a method to create a file, which requires us to complete the “road safety first” through another way. At that time, we used the general with open to create a file. OK, no problem. The creation was successful. The next problem is the error of zipfile.badzipfile: file is not a zip file during data storage, It’s said that the file that is not zip is rushing to work. Suddenly, it’s a flash of inspiration. When the pandas module is used, it’s just that the file can be operated. In the end, the overall code has not changed. The only change is to attach the code at the step of creating the file

def isfile(self, file):
print(file)
if not os.path.isfile(file):
df = pd.DataFrame(columns=['name', 'shake number', 'weibo', 'profile', 'estimated sales']) # Create a table object, without creating the content first
df.to_excel(self.filr, index=False) # Save the object as an .xlsx file
return file


Call the function to execute retuan and return the path URL for subsequent operation

# [Solved] Win10 and Linux address reading format is different (CV2. Error: opencv (4.2.0)/Io/opencv…)

img = cv2.resize(img, (512, 1024))
cv2.error: OpenCV(4.2.0) /io/opencv/modules/imgproc/src/resize. cpp:4045 : error: (-215:Assertion failed) ! ssize.empty() in function ‘resize’

The code can run normally in win10, but the above error is reported in Linux. My analysis is due to the different address reading formats between win10 and Linux.

img   = cv2.imread(item['path'])
#item['path']：'./data/TuSimple/LaneDetection\clips/0313-2/42120/20.jpg'


There is a ‘\’ in the address of item [‘path ‘], which results in an error in Linux operation
so change the’ \ ‘in the address of item [‘path’] to ‘/’

item['path']=item['path'].replace('\\', '/')#Add this code


# How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow

preface
There are various problems encountered during the use of TensorFlow. It is helpful to write them down for review and future learning
Problem description
When TensorFlow is installed in Anaconda, the following problem is encountered:

>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Anaconda\envs\dl\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
File "D:\Anaconda\envs\dl\lib\site-packages\tensorflow\python\__init__.py", line 59, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "D:\Anaconda\envs\dl\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "D:\Anaconda\envs\dl\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
ImportError: DLL load failed: The specified program could not be found.


The solution
Protobuf was upgraded yesterday when Object-Detection was installed, so if you call back the version of Protobuf, you should be fine.

pip install protobuf==3.6.0


# Servlet.service() for servlet [dispatcherServlet] in context && Whitelabel Error Page

ERROR 8040 – O.A.C.C.C. [nio – 8080 – exec – 1]. [[. [/] [dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

to find for a long time, found and @autowired didn’t add question

# Solution to “[dbnetlib] [connectionwrite (send()).] general network error”

Recently, I need to use Excel to generate a series of charts, the data is naturally obtained through sql server. The problem is that this excel has nearly 50 charts, and each chart has to be connected to DB to get the data. The problem comes, when refreshing all the time often encountered
“[DBNETLIB] [ConnectionWrite (send()). General network error. Check your network documentation” error. The initial judgment is definitely too much data connection caused by (for Excel rookies do not have the ability to solve from the Excel side). After a while Google, finally found a solution, maybe not the best, right as a record.

Possible causes.
This problem occurs because Windows Server 2003 and higher implements a security feature that reduces the size of the queue of concurrent TCP/IP connections to the server. This feature helps prevent denial-of-service attacks. Under high load conditions, the TCP/IP protocol may incorrectly recognize a valid TCP/IP connection as a denial-of-service attack. This behavior can lead to the problems described in the Symptoms section.

Solution.
This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if the registry is not modified correctly. Therefore, make sure you follow these steps carefully. For extra protection, back up the registry before modifying it. Then, if a problem occurs, you can restore the registry.
To resolve this issue, turn off this new feature by adding SynAttackProtect entry to the following registry entry for the computer that is running Microsoft SQL Server, which houses your BizTalk server database.

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Tcpip \ \ Service Parameters

Settings

SynAttackProtect

Enter a DWORD value of 00000000. to do this, follow these steps:
Click Start, click Run, type regedit, and then click OK. Find and click on the following registry entry:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Tcpip \ \ Service Parameters

On the Edit menu, point to New, then click on the DWORD value. Type SynAttackProtect, and then press ENTER. Click Modify on the Edit menu. In the Value Data box, type 00000000. click OK. exit the Registry Editor.
Note To complete this registry change, you must restart the computer running SQL Server.

# MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..

When exporting data with MySQL 5.7, an error was reported. The error was reported as follows:

Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

According to the wrong information, we found that secure-file-priv will specify the folder as the place where the exported files are stored, so we can find this folder first.

Solution 1:

enter the following command in the MySQL command line interface:

show variables like '%secure%';

Annotated is the correct file path, we will export files in this directory.
For SQL instructions, modify as follows:

SELECT * FROM User details WHERE gender='male'
INTO OUTFILE 'C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Uploads\\man.txt'

The file can be successfully exported to this directory.
Solution 2:
Go to the installation path C:\ProgramData\MySQL\MySQL Server 5.7, find my. Ini file and modify the default save path of Secure-file-priv.
Secure_file_prive =null — mysqld does not allow import and export
secure_file_priv=/ TMP/– limits the import and export of mysqld to only occur in the/TMP/directory
secure_file_priv= “” — does not restrict the import and export of mysqld

# [Android Error] java.lang.RuntimeException: An error occurred while executing doInBackground()

Recently, a bug was added to the task list to be resolved in this sprint. The stack information of the bug is as follows:

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
Caused by java.lang.SecurityException: Caller no longer running, last stopped +25s437ms because: timed out while starting
at android.app.job.IJobCallback$Stub$Proxy.dequeueWork(IJobCallback.java:191)
at android.app.job.JobParameters.dequeueWork(JobParameters.java:196)
at android.support.v4.app.JobIntentService$JobServiceEngineImpl.dequeueWork(JobIntentService.java:309) at android.support.v4.app.JobIntentService.dequeueWork(JobIntentService.java:627) at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:384)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:377) at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)  According to the above bug information, it can be known that the system JobIntentService, AsyncTask doInBackground is called, while doInBackground calls dequeueWork. The following is the source code (source code of androidx 1.1.0) : final class CommandProcessor extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { GenericWorkItem work; if (DEBUG) Log.d(TAG, "Starting to dequeue work..."); while ((work = dequeueWork()) != null) { if (DEBUG) Log.d(TAG, "Processing next work: " + work); onHandleWork(work.getIntent()); if (DEBUG) Log.d(TAG, "Completing work: " + work); work.complete(); } if (DEBUG) Log.d(TAG, "Done processing work!"); return null; }  dequeueWork() source code is as follows, let’s focus on mJobImpl! = null part, will enter  mjobimpl.dequeuework () part:  GenericWorkItem dequeueWork() { if (mJobImpl != null) { return mJobImpl.dequeueWork(); } else { synchronized (mCompatQueue) { if (mCompatQueue.size() > 0) { return mCompatQueue.remove(0); } else { return null; } } } }  mJobImpl is actually a , CompatJobEngine, source code and is the implementation class JobServiceEngineImpl as follows:  interface CompatJobEngine { IBinder compatGetBinder(); GenericWorkItem dequeueWork(); } @RequiresApi(26) static final class JobServiceEngineImpl extends JobServiceEngine implements JobIntentService.CompatJobEngine { @Override public JobIntentService.GenericWorkItem dequeueWork() { JobWorkItem work; synchronized (mLock) { if (mParams == null) { return null; } work = mParams.dequeueWork(); } if (work != null) { work.getIntent().setExtrasClassLoader(mService.getClassLoader()); return new WrapperWorkItem(work); } else { return null; } } }  As you can see from the bug information at the beginning of the article, it goes to  mparams.dequeuework (); Binder, then enter the Binder mechanism, the source code is as follows, so we can conclude that there is a problem here, throwing an exception, but because this is part of the source code, it should not be our responsibility.  public @Nullable JobWorkItem dequeueWork() { try { return getCallback().dequeueWork(getJobId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ @UnsupportedAppUsage public IJobCallback getCallback() { return IJobCallback.Stub.asInterface(callback); }  After query source, found that the problem appeared in the framework layer, and there are already online issue of the problem: https://github.com/evernote/android-job/issues/255 https://issuetracker.google.com/issues/63622293 online encounter this kind of problem a lot of a lot of people, but so far, I have checked the latest Google androidx library ("androidx.core:core-ktx:1.2.0-rc01") and still haven’t solved this problem. App . In this package, a new class SafeJobIntentService</code b> is inserted into the JobIntentService. The reason for this is that the dequeueWork() method is not public. We have to write in the same package to override its methods and fix bugs. @RestrictTo({Scope.LIBRARY}) public abstract class SafeJobIntentService extends JobIntentService { public SafeJobIntentService() { } GenericWorkItem dequeueWork() { try { return super.dequeueWork();//1 Here we do a try/catch operation on this method } catch (SecurityException var2) { var2.printStackTrace(); return null; } } public void onCreate() { super.onCreate(); if (VERSION.SDK_INT >= 26) { this.mJobImpl = new SafeJobServiceEngineImpl(this); } else { this.mJobImpl = null; } } } @RequiresApi(26) public class SafeJobServiceEngineImpl extends JobServiceEngine implements CompatJobEngine { static final String TAG = "JobServiceEngineImpl"; static final boolean DEBUG = false; final JobIntentService mService; final Object mLock = new Object(); JobParameters mParams; SafeJobServiceEngineImpl(JobIntentService service) { super(service); this.mService = service; } public IBinder compatGetBinder() { return this.getBinder(); } public boolean onStartJob(JobParameters params) { this.mParams = params; this.mService.ensureProcessorRunningLocked(false); return true; } public boolean onStopJob(JobParameters params) { boolean result = this.mService.doStopCurrentWork(); synchronized(this.mLock) { this.mParams = null; return result; } } public GenericWorkItem dequeueWork() { JobWorkItem work = null; synchronized(this.mLock) { if (this.mParams == null) { return null; } try { work = this.mParams.dequeueWork(); } catch (SecurityException var5) { var5.printStackTrace(); } } if (work != null) { work.getIntent().setExtrasClassLoader(this.mService.getClassLoader()); return new SafeJobServiceEngineImpl.WrapperWorkItem(work); } else { return null; } } final class WrapperWorkItem implements GenericWorkItem { final JobWorkItem mJobWork; WrapperWorkItem(JobWorkItem jobWork) { this.mJobWork = jobWork; } public Intent getIntent() { return this.mJobWork.getIntent(); } public void complete() { synchronized(SafeJobServiceEngineImpl.this.mLock) { if (SafeJobServiceEngineImpl.this.mParams != null) { try { SafeJobServiceEngineImpl.this.mParams.completeWork(this.mJobWork); } catch (SecurityException | IllegalArgumentException var4) { // 2 Here we also perform a try/catch operation on the completeWork var4.printStackTrace(); } } } } } }  On the basis of the source code, the above code only handles Exception at 1 and 2</code b>. The rest of the code does not change, so we can compare the source code to see the comparison. If you have a three-party library in your project that has introduced this SafeJobIntentService class, but because you can't use this class of them, and you refer to such as implementation 'com.evernote:android-job:1.4.2' library, duplicate class found in the module. If this problem occurs, we can rename the class and follow the above code to deal with it. Hopefully Google will add a solution to this problem in future libraries. JSON has three methods for parsing data  # Solution to latex “too many unprocessed floats” error This error occurred because more than 18 graphs and tables were placed in a row without any text in between.These solutions are available online: 1. Using macro package \usepackage[section]{placeins} 2. Start using \ ClearPage on each pageBut after the author used the above method, although the error is not reported, but the layout of the picture is still a bit messy. In fact, this error is caused by the continuous placement of too many floating graphics. The author to check the LaTex books (http://www.ctex.org/documents/latex/graphics/node2.html), 20 according to the book. Do not float the figure, remove the figure environment (that is, add pictures as non-floating graphics), the problem is solved. Code used by the author: \centerline{\includegraphics[width=12cm]{fig1}} \caption{fig1}\label{fig1} %\vspace{5mm} \centerline{\includegraphics[width=12cm]{fig2}} \caption{fig2}\label{fig2} %\vspace{5mm} \centerline{\includegraphics[width=12cm]{fig3}} \caption{fig3}\label{fig3} . . . %\vspace{5mm} \centerline{\includegraphics[width=12cm]{fig20}} \caption{fig20}\label{fig20} where vspace{5mm} can be adjusted for image spacing. Update: If you must use the Figure environment, you can combine \ ClearPage with! H parameters are used together, such as: \begin{figure}[!h] \centerline{\includegraphics[width=12cm]{fig17}} \caption{Experimental results of the 17th image frame}\label{fig17} \end{figure} \clearpage \begin{figure}[!h] \centerline{\includegraphics[width=12cm]{fig18}} \caption{Experimental results of the 18th image frame}\label{fig18} \end{figure} \ ClearPage where it was at the end of the previous page. # [Solved] void value not ignored as it ought to be Error “void value not ignored as it ought to be” appears in GCC, The reason is that you are using a function whose return type is void, and you have assigned it. Such as: int ret; ret=unregister_chrdev(MAJOR_NUM,”globalvar”); # Error handling response: Error: Syntax error, unrecognized expression: .c-container /deep/ .c-contai The following error message appears on the browser console: Error handling response: Error: Syntax error, unrecognized expression: .c-container /deep/ .c-container at Function.se.error () at se.tokenize () at se.select () at Function.se [as find] () at S.fn.init.find () at new S.fn.init () ...  After checking, it is found that the plug-in affects the global $. After deleting the plug-in in the browser (you need to confirm which plug-in it is), you can solve the error

Maven plugin error execution default descriptor of goal org. Apache. Maven plugins:maven-plugin-plugin :3.2:descriptor failed

The above error occurred when writing Maven plug-in.

Solution

Display the version number of the specified Maven plugin plugin in POM. XML

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5.2</version>
</plugin>
</plugins>
</build>


other error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project maven-project: Error extracting plugin descriptor: ‘No mojo definitions were found for plugin
How to Solve
Show the version number of the specified maven-plugin-plugin in pom.xml

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<!-- Or add a descriptor to the mojo class comment -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
</plugins>
</build>


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project xxx: Fatal error compiling: basedir D:\xxx\target\generated-test-sources\test-annotations does not exist -> [Help 1]

Solution
Skip the test during installation

mvn install -DskipTests=true


# Error:Cannot build artifact xxx:war exploded’ because it is included into a circular dependency

Error:Cannot build artifact xxx:war exploded’ because it is included into a circular dependency solution
IDEA error: Error:Cannot build artifact xxx:war exploded’ because it is included into a circular dependency

How to Solve:
ctrl + alt + shift + s Open project structure (or ctrl alt + a to search for project structure)
Click on the left artifacts and delete the two extra ones, which are
xxx:warxxx:war exploded
Delete is OK