}

Python 3: ValueError: bad marshal data (unknown type code)

Created:

The error

When you executed setup.py install and you get the error:

Traceback (most recent call last): File "setup.py", line 263, in tests_require=['pytest', 'flask'] + dev_required, File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/__init__.py", line 143, in setup return distutils.core.setup(**attrs) File "/Users/lcubo/.pyenv/versions/3.7.2/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/Users/lcubo/.pyenv/versions/3.7.2/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/Users/lcubo/.pyenv/versions/3.7.2/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "/Users/lcubo/.pyenv/versions/3.7.2/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Users/lcubo/.pyenv/versions/3.7.2/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 220, in run os.path.join(archive_root, 'EGG-INFO'), self.zip_safe() File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 273, in zip_safe return analyze_egg(self.bdist_dir, self.stubs) File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 383, in analyze_egg safe = scan_module(egg_dir, base, name, stubs) and safe File "/Users/lcubo/.pyenv/versions/faradaypy3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 422, in scan_module code = marshal.load(f) ValueError: bad marshal data (unknown type code)

Solution

You need to clean pyc files recursively. It's common that you try to execute the project with python2. Clean pycs files recursively with:

find . -name "*.pyc" -exec rm -f {} \;