Issue #5 resolved

not helpful error message

eduardo schettino
created an issue

I am trying to use coverage r172 using python 2.4.

When I try to generate a report I get: {{{


$ coverage -r xxxc Name Stmts Exec Cover

xxxc tokenize.TokenError: ('EOF in multi-line statement', (104, 0)) }}}

if i ignore the error with: {{{


$ coverage -i -r xxxc Name Stmts Exec Cover


I don't get anything at all.

It works with coverage 2.85.

Comments (9)

  1. eduardo schettino reporter

    the coverage works now.

    but it still leaves some garbage "xxxc" file.

    and i think it would be better not give a tokeninze error if a user ask to report a non-python file.

  2. jlundell
    • changed version to 3.3

    I'm getting the same (multi-line) error message with 3.3.1. I'm generating a data file thus:

    from coverage import coverage
    cov = coverage(data_file='vpepm.coverage')

    ...the test runs to completion, the requested file is created, but:

    $ coverage report vpepm.coverage 
    Name    Stmts   Exec  Cover
    vpepm   TokenError: ('EOF in multi-line statement', (27, 0))
  3. Ned Batchelder repo owner

    The argument to the "report" command is meant to be a python module, not the collected data file. coverage is trying to parse the pickled coverage data as Python source, and "EOF in multi-line statement" is what results.

    There's no command-line switch to use a different data file, but you can set the COVERAGE_FILE environment variable to get the same effect:

    COVERAGE_FILE=vpepm.coverage coverage report

    I'll add a "--data" option to the TODO list.

  4. jlundell

    That would be nice, but it's no problem for me to use the default name; I'll just do that. The most useful TODO for this would IMO be earlier detection and a more informative error message. Thanks, and it's now working great.

  5. Log in to comment