18๐
I also encountered the error:
EOFError: marshal data too short.
Even though no changes were made to any of the existing files, this error was thrown.
Some *.pyc files get created automatically which are compiled byte code of a script, which gets dynamically created when a Python script runs to speed up future launches.
I am using an Oracle VM VirtualBox manager, working on Python
.
I was trying to install pyspark
.
The spark folder structure was something like this
spark****/python/pyspark
Under this folder contained a folder by name โ__pycache__โ
I went to the pyspark folder and deleted the โ__pycache__โ folder using the command:
rm -r __pycache__/
This eliminated the error for me and I am now able to import pyspark.
Hope this helps.
7๐
I delete all .pyc
files using terminal and it worked for me
find . -name \*.pyc -delete