this problem is really annoying, it took me half a day to solve. It turns out that the reason is a small problem, but it is usually ignored, looking for a long time on the Internet seems to be different from my situation
is timed to query the current port concurrency every 30 seconds and record it in the document
import os
from threading import Thread
def check_count():
def check_count():
MSG = os.popen(‘ netstat -nat |grep 9995 | wc-l ‘)
count = msg.read()
current_time = datetime. Datetime. Now (). Strftime (“%Y-%m-%d %H:% m :%S”)
with Open (‘ /home/opvis/transfer_server/log/ check_port.log ‘, ‘a’) as f:
f.write(current_time + ‘, current time concurrent visits are: ‘+ count)
time.sleep(30)
t= Thread(target=check_count)
t.daemon (True)
t.daemon ()
results will run normally, but at the terminal will always report the following error :
because the last os.popen execution object was not closed. The next time the loop executes os.popen, the error will appear
.
will no longer be displayed
def check_count():
def check_count():
MSG = os.popen(‘ netstat -nat |grep 9995 | wc-l ‘)
count = msg.read()
current_time = datetime. Datetime. Now (). Strftime (“%Y-%m-%d %H:% m :%S”)
with Open (‘ /home/opvis/transfer_server/log/ check_port.log ‘, ‘a’) as f:
f.write(current_time + ‘, current time concurrent visits are: ‘+ count)
MSG. Close ()
time.sleep(30)
t= Thread(target=check_count)
t.daemon (True)
t.daemon ()
Read More:
- Waitpid call return error prompt: no child processes problem
- Error in installing pywin32 under Windows: close failed in file object D estructor:sys.excepthook is missing lost sys.stderr
- Importerror of [docker] error: libGL.so .1: cannot open shared object file: No such file or directory
- ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
- Problem solving: importerror: libcublas.so .9.0: cannot open shared object file: No such file
- error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file
- OSError: libnccl.so.2: cannot open shared object file: No such file or directory
- error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file o
- error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file
- Zend studio HTML error prompt close, PHP “error prompt” open and close the correct way
- Error in header file when calling OpenGL to open obj file in vs2013: unable to open include file: “GL / glut. H”: no such file or directories
- Destructor abnormal stuck bug
- No code, a solution to the error in the path of reading CSV file by Python: filenotfounderror: [errno 2] no such file or directory: ‘XX. CSV‘
- Solve the error in Ubuntu 18.04: called “net usershare info” but it failed: failed to execute child process “net”
- Ubuntu: Failed to initialize compiler: object java.lang.Object In compiler mirror not found
- Error:could not fork child process: There are no available terminals (-1).
- react Error: Objects are not valid as a React child (found: object with keys {username, password})
- Ioerror: [errno 13] permission denied
- Solution to error opening trace file: no such file or directory (2) in Android
- Error: Could not fork child process: There are no available terminals (-1).