Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python EOFerror when importing a module after unplugging Raspberry Pi

I have a python3.2 script running from rc.local at startup on a raspberry pi - Raspbian OS, it imports a file called inouts.py module that i made and lives in the same directory, ive updated the sys.path.append(...)

The script worked fine for weeks. Today I had to unplug the rpi without shutting down.

After rebooting the script fails to open and gives the error: EOFError: EOF read where not expected

The inouts.py is definitely the module causing the error as I have it on its own line.

If I change the name from inouts.py to inouts2.py the script works. If I run it as python2 it also works.

Can anybody point me in the right direction on what might be causing this filename to cause this error?

Traceback (most recent call last):
File "rf2.py", line 3, in <module>
import inouts
EOFError: EOF read where not expected
like image 339
fairywings78 Avatar asked Mar 19 '23 16:03

fairywings78


1 Answers

I solved this problem myself today by deleting all of the *.pyc files in the __pycache__ subdirectory.

like image 141
Kit S Avatar answered Apr 25 '23 18:04

Kit S