Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python IOError: [Errno 5] Input/output error?

Tags:

python

I m running on a remote server a python script using nohup.

  • First I connected to the remote machine using a VPN and SSH
  • Second I run a python script using the following command:

    nohup python backmap.py mpirun -np 48 &

The python script contains the following lines:

frame = []
file_in = open("Traj_equil_prot.pdb", "r")
for line in file_in:
    if line.startswith('TITLE'):
        frame.append(line[127:134])

import os
for fileNum in range(631, 29969):
    os.system("./initram-v5.sh -f Traj_equil_prot_frame" +  str(fileNum) + ".pdb -o Traj_equilprot_aa_frame" + str(frame[fileNum]) + ".gro -to amber -p topol.top")

The script was running just fine the whole day. but now it just crashed and when I try to re-launch it again I'm getting the following error:

Traceback (most recent call last): File "", line 1, in IOError: [Errno 5] Input/output error

The file is in the working directory. I tried to disconnect/connect again but still the same problem. I don't know what I'm missing. Any help, please?

like image 953
FZJ Avatar asked Sep 17 '18 23:09

FZJ


People also ask

What is errno 5?

This almost always indicates a read error from the installation media... Verify the checksum of your ISO, then try a different USB stick, and/or a different image write utility (if you're using Rufus, try Etcher, or vise-versa).

What is input output error in Python?

What is an IOError in Python? IOError means Input/Output error. It occurs when a file, file path, or OS operation we're referencing does not exist. For example, if you are running a runtime operation on an existing file, and the file goes missing from the location, Python will throw an IOError.

What causes input output error?

Reasons for I/O Device ErrorThe computer storage device driver is outdated, damaged or incompatible with your attached device. The external hard drive, memory card or USB drive is recognized with a wrong drive letter. The external hard drive, memory card or USB drive that you are trying to access is dirty or damaged.


1 Answers

I had the same problem, I used to run my script using this command:

python MY_SCRIPT.py &

The script will run in the background and the output will be displayed on the terminal until you logout or exit.

By logging out, the script is still running but it's output has nowhere to display thus, exceptions will be made when the script wants to display something (e.g. calling print).


Solution:

I've piped the output to somewhere other than the actual terminal display:

python MY_SCRIPT.py >/dev/null &

Checkout this link for more details:

https://stackoverflow.com/a/38238281/6826476

like image 188
Omid N Avatar answered Oct 28 '22 02:10

Omid N