Error with trace.py

F

Felix Wiemann

$ cat test.py
print "Hello World!"
if 0:
print "Never executed."
if 1:
print "Hi."

$ python test.py
Hello World!
Hi.

$ python /usr/lib/python2.3/trace.py --count test.py
Hello World!
Hi.
trace: Could not open '/usr/lib/python2.3/threading.cover' for writing: [Errno 13] Permission denied: '/usr/lib/python2.3/threading.cover'- skipping
Traceback (most recent call last):
File "/usr/lib/python2.3/trace.py", line 690, in ?
main()
File "/usr/lib/python2.3/trace.py", line 687, in main
results.write_results(missing, summary=summary, coverdir=coverdir)
File "/usr/lib/python2.3/trace.py", line 271, in write_results
lnotab, count)
TypeError: unpack non-sequence

Why doesn't it work?

By the way, after running trace.py, there is a file test.cover in the
directory:

$ cat test.cover
1: print "Hello World!"
if 0:
print "Never executed."
1: if 1:
1: print "Hi."
 
S

Stewart Midwinter

Why doesn't it work?

well, are you running as non-root, but trace.py is trying to write to
a directory that only root has access to?

I tried the example under Windows, since under Linux I only have
Python 2.2 which doesn't have trace.py.

---
D:\data\python>python d:\python23\lib\trace.py -c -f
d:\data\python\counts test1.py

creates a file counts and a file test.cover. The former is a binary
file, while the latter is a marked-up version of the input file.

S
 
F

Felix Wiemann

Stewart said:
well, are you running as non-root, but trace.py is trying to write to
a directory that only root has access to?

Yes, obviously. :)
I tried the example under Windows

D:\data\python>python d:\python23\lib\trace.py -c -f d:\data\python\counts test1.py

Doesn't work either.

But I found out that it works when using "--coverdir=.":

$ python /usr/lib/python2.3/trace.py --count --coverdir=. test.py
 
S

Skip Montanaro

Stewart> I tried the example under Windows, since under Linux I only
Stewart> have Python 2.2 which doesn't have trace.py.

I believe it's there, just under Tools/scripts.

Skip
 

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
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top