How to run shell-commands in IPython? (Python Profiling GUI tools) -


i trying file profiling in ipython, generate profiling stats output , pass python profiling gui tools kcachegrind. here code trying that. codes executed in ipython.

# example function profiling def factorial(n):     if n == 0:         return 1.0     else:         return float(n) * factorial(n-1)  def taylor_sin(n):     res = []     in range(n):         if % 2 == 1:            res.append((-1)**((i-1)/2)/float(factorial(i)))         else:            res.append(0.0)     return res  # generate cprofile output (the stats, not text) %prun -d prof.out x = taylor_sin(500)  # conversion using pyprof2calltree # in ipython, add prefix '!' code make shell-command code !pyprof2calltree -i prof.out -o prof.calltree 

and ipython prints error message:

!pyprof2calltree -i prof.out -o prof.calltree /bin/sh: 1: pyprof2calltree: not found 

is saying haven't add pyprof2calltree environment path or that? how solve it?

i can run in pure shell command. don't switch between ipython , terminal, , want stuff in ipython. understand adding prefix ! make codes run in shell command, why raise error me shown above?

jian@home-pc:~/dropbox/coding/python$ pyprof2calltree -i prof.out -o   prof.calltree writing converted data to: prof.calltree jian@home-pc:~/dropbox/coding/python$ 

ipython installed anaconda py3.4; operating system ubuntu 14.04; pyprof2calltree installed via pip

from ipython example in pyprof2calltree documentation:

>>> pyprof2calltree import convert, visualize >>> visualize('prof.out') >>> convert('prof.out', 'prof.calltree') 

or:

>>> results = %prun -r x = taylor_sin(500) >>> visualize(results) >>> convert(results, 'prof.calltree') 

you try:

>>> %run -m pyprof2calltree -i prof.out -o prof.calltree 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -