1. Ned Batchelder
  2. coverage.py
  3. Issues
Issue #264 resolved

Coverage won't run pyc files

Ned Batchelder
repo owner created an issue

Trying to run a .pyc file produces this:

Coverage.py warning: No data was collected.
Traceback (most recent call last):
  File "/usr/local/pythonz/pythons/CPython-2.7.5/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/pythonz/pythons/CPython-2.7.5/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/ned/coverage/trunk/coverage/__main__.py", line 4, in <module>
    sys.exit(main())
  File "coverage/cmdline.py", line 720, in main
    status = CoverageScript().command_line(argv)
  File "coverage/cmdline.py", line 438, in command_line
    self.do_execute(options, args)
  File "coverage/cmdline.py", line 575, in do_execute
    self.run_python_file(filename, args)
  File "coverage/execfile.py", line 111, in run_python_file
    code = compile(source, filename, "exec")
TypeError: compile() expected string without null bytes

Note that Python will also execute a .pyc file renamed to something else like .xxx

Comments (1)

  1. Log in to comment