Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage won't run pyc files #264

Closed
nedbat opened this issue Sep 18, 2013 · 1 comment
Closed

Coverage won't run pyc files #264

nedbat opened this issue Sep 18, 2013 · 1 comment
Labels
bug Something isn't working run

Comments

@nedbat
Copy link
Owner

nedbat commented Sep 18, 2013

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


@nedbat
Copy link
Owner Author

nedbat commented Sep 28, 2013

Fixed in f560a96b9f51 (bb)

Note that we only run .pyc and .pyo files. If you rename one to something else, it will still fail with a compile error.

@nedbat nedbat closed this as completed Sep 28, 2013
@nedbat nedbat added minor bug Something isn't working run labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working run
Projects
None yet
Development

No branches or pull requests

1 participant