Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Python 3 attempting to view lprof file. #170

Description

@bobhancock

Cmd Line: kernprof -v ./simply.py.lprof

Some of the report is displayed and then this staacktrace below. I inserted a pdb.set_trace() in kernprof.py and the filename is correct and the file handle also.

Traceback (most recent call last):
File "/usr/bin/kernprof", line 11, in
load_entry_point('line-profiler==2.1.1', 'console_scripts', 'kernprof')()
File "/usr/local/google/home/rwh/.local/lib/python3.7/site-packages/kernprof.py", line 226, in main
prof.runctx('execfile_(%r, globals())' % (script_file,), ns, ns)
File "/usr/local/google/home/rwh/python/src/pyenv/versions/3.7.0/lib/python3.7/cProfile.py", line 100, in runctx
exec(cmd, globals, locals)
File "", line 1, in
File "/usr/local/google/home/rwh/.local/lib/python3.7/site-packages/kernprof.py", line 36, in execfile
with open(filename, 'rb') as f:
ValueError: source code string cannot contain null bytes

try:
execfile
except NameError:
# Python 3.x doesn't have 'execfile' builtin
import builtins
exec_ = getattr(builtins, "exec")

def execfile(filename, globals=None, locals=None):
   pdb.set_trace()
    with open(filename, 'rb') as f:
        exec_(compile(f.read(), filename, 'exec'), globals, locals)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions