[TIP] can't install coverage.py
Ned Batchelder
ned at nedbatchelder.com
Wed Jun 9 08:56:05 PDT 2010
On 6/9/2010 11:18 AM, Michael Foord wrote:
> On 09/06/2010 16:13, Gary Robinson wrote:
>> Hello,
>>
>> I'm trying to install coverage.py. Whether I use easy_install or
>> setup.py, I get the same error, shown below. Does anyone know why
>> this would happen? The Python I have installed is unladen swallow,
>> but I generally have no problem installing packages into it. Also, in
>> case it's relevant, I'm on SUSE Linux.
>>
>> sudo python setup.py install
>> Traceback (most recent call last):
>> File "setup.py", line 50, in<module>
>> from coverage import __url__, __version__
>> File "/home/grobinson/coverage-3.3.1/coverage/__init__.py", line
>> 12, in<module>
>> from coverage.control import coverage, process_startup
>> File "/home/grobinson/coverage-3.3.1/coverage/control.py", line
>> 14, in<module>
>> from coverage.results import Analysis
>> File "/home/grobinson/coverage-3.3.1/coverage/results.py", line 7,
>> in<module>
>> from coverage.parser import CodeParser
>> File "/home/grobinson/coverage-3.3.1/coverage/parser.py", line
>> 256, in<module>
>> 'BREAK_LOOP', 'CONTINUE_LOOP',
>> File "/home/grobinson/coverage-3.3.1/coverage/parser.py", line
>> 248, in _opcode_set
>> return set([_opcode(name) for name in names])
>> File "/home/grobinson/coverage-3.3.1/coverage/parser.py", line
>> 244, in _opcode
>> return opcode.opmap[name]
>> KeyError: 'RAISE_VARARGS'
>>
> It could well be the fact that you're using unladen swallow. Recent
> versions of coverage work through bytecode modification and unladen
> swallow includes some bytecode optimisations that may be a cause of
> incompatibility.
>
> Michael
>
The code that's failing is trying to look up byte codes by name, and it
looks like Unladen Swallow doesn't have a RAISE_VARARGS bytecode. It's
pretty sloppy of me to be doing so much unneeded work during
installation, but Unladen Swallow isn't yet supported by coverage.py, so
perhaps the early failure was a good thing.
Gary, I don't know how invested you are in getting this to work. You
could hack on coverage.py to see if you can make it work. In this case,
simply removing RAISE_VARARGS from line 255 of parser.py will get past
this error, and not harm the code. I don't know what else you'll
discover, but we can take this offline if you are interested in pursuing it.
--Ned.
More information about the testing-in-python
mailing list