I have ran kernprof
on a file called RP.py
and it spits out RP.py.lprof
Now, i'm trying to view this file. If i open a cmd
window and type python -m line_profiler RP.py.lprof
it gives me the text, but it not formatted in a way that I can read it.
Is there a way to 1) turn lprof
into text?
or run it in a shell. I have tried:
import sys
import subprocess
subprocess.call([sys.executable,'C:\\Python27\\python.exe', '-m', 'line_profiler', 'RP.py.lprof'])
Execute a file with arguments in Python shell from this link. But this doesn't work.
I don't have ready access to a Windows box, but my first guess based on the description is that the line-endings are \\n
instead of \\r\\n
. Try piping the results to a text file and then open it in a programmer's editor ( not Notepad).
python -m line_profiler RP.py.lprof > results.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.