Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems running coverage.py

1 view
Skip to first unread message

Vijay Sankar

unread,
Aug 30, 2004, 2:46:08 AM8/30/04
to
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


Skip Montanaro

unread,
Aug 30, 2004, 11:35:14 AM8/30/04
to Vijay Sankar, pytho...@python.org

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.

--
Skip Montanaro
Got spam? http://www.spambayes.org/
sk...@pobox.com

0 new messages