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
Read More:
- [Solved] Azkaban uploads Zip file error: installation failed.malformed
- [Solved] ERROR: Could not open requirements file: [Errno 2] No such file or directory : ‘requirments.txt‘
- Failed to copy files Error processing tar file [How to Solve]
- [Solved] azkaban Upload zip Error :Error Chunking during uploading files to db
- Keil Compile Error: ..\OBJ\USART.axf: error: L6002U: Could not open file ..\obj\sys.o: No such file or directory
- [Solved] fatal error C1083: Cannot open included files: “stdafx.h”: No such file or directory
- [Solved] fatal error C1083: Could Not Open Unable to open include file:“stdint.h”: No such file or directory
- Cli Write Error: This is related to npm not being able to find a file. [Solved]
- [Solved] error: Pulling is not possible because you have unmerged files
- [Solved] import mxnet Error: OSError: libcudart.so.8.0: cannot open shared object file: No such file or directory
- kernel module insert error: ERROR: could not insert module …../file.ko : File exits
- [Solved] import cv2 Error: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- Vue Error reported after introduction of path: Already included file name ‘××ב differs from file name ‘××ב only in casing.
- VSCode Unable to find custom header file directory: fatal error: no such file or directory
- ApplicationContext.xml file header error Referenced file contains errors
- error while loading shared libraries: lib*.so: cannot open shared object file: No such file or directory
- Win7 Install .NET Extracting Files: There is not enough disk space……
- [Solved] TS Error: Could not find a declaration file for module
- [Solved] Jmeter Error: Error loading results file – see file log
- [Solved] VScode Run C++ File Error: fatal error:opencv2\core.hpp:No such file or diretory