Problems running coverage.py

V

Vijay Sankar

Hi,

I am using coverage.py to check the code coverage for some of my Python
scripts.

For a particular script which uses 'exit' calls, I am getting the following
error when I invoke the script with the -x option for coverage.

Error in sys.exitfunc:
Traceback (most recent call last):
File "D:\Python23\lib\atexit.py", line 20, in _run_exitfuncs
func(*targs, **kargs)
File "D:\Python23\Lib\site-packages\coverage.py", line 207, in save
cache = open(self.cache, 'wb')
TypeError: an integer is required

Looks like coverage.py is not able to record the coverage data on calling
exit.
Does anybody know how to solve this?

Thanks,
Vijay
 
S

Skip Montanaro

Vijay> For a particular script which uses 'exit' calls, I am getting the
Vijay> following error when I invoke the script with the -x option for
Vijay> coverage.

Vijay> Error in sys.exitfunc:
Vijay> Traceback (most recent call last):
Vijay> File "D:\Python23\lib\atexit.py", line 20, in _run_exitfuncs
Vijay> func(*targs, **kargs)
Vijay> File "D:\Python23\Lib\site-packages\coverage.py", line 207, in save
Vijay> cache = open(self.cache, 'wb')
Vijay> TypeError: an integer is required

Vijay> Looks like coverage.py is not able to record the coverage data on
Vijay> calling exit. Does anybody know how to solve this?

Just a wild-ass guess, but I suspect there's a module imported like

from somemodule import *

which dumped an "open" symbol into the global namespace, thus hiding the
open() builtin. You might try adding this line

print open

right before the call to open() to see if you're getting the builtin open or
not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,204
Messages
2,571,065
Members
47,672
Latest member
svaraho

Latest Threads

Top