rkern / line_profiler

(OLD REPO) Line-by-line profiling for Python - Current repo ->
https://github.com/pyutils/line_profiler
Other
3.6k stars 254 forks source link

ValueError: source code string cannot contain null bytes #93

Closed joleroi closed 7 years ago

joleroi commented 7 years ago

When I run this script

import numpy as np

@profile
def myadd(a, b):
    return a + b

for a,b in zip(np.arange(10), np.arange(10)):
    print(myadd(a,b))

on my machine with

python --version
Python 3.5.3 :: Continuum Analytics, Inc.

and

conda list line_profile
# packages in environment at <...>/Software/miniconda3/envs/headversions:
#
line_profiler             2.0                      py35_0

it fails with this traceback

kernprof -l python test.py
Wrote profile results to python.lprof
Traceback (most recent call last):
  File "/home/kingj/Software/miniconda3/envs/headversions/bin/kernprof", line 6, in <module>
    sys.exit(kernprof.main())
  File "/home/kingj/Software/miniconda3/envs/headversions/lib/python3.5/site-packages/kernprof.py", line 222, in main
    execfile(script_file, ns, ns)
  File "/home/kingj/Software/miniconda3/envs/headversions/lib/python3.5/site-packages/kernprof.py", line 35, in execfile
    exec_(compile(f.read(), filename, 'exec'), globals, locals)
ValueError: source code string cannot contain null bytes

Any idea what could cause this?

rkern commented 7 years ago

kernprof -l test.py not kernprof -l python test.py

joleroi commented 7 years ago

:see_no_evil: