csurfer / pyheatmagic

IPython magic command to profile and view your python code as a heat map.
MIT License
1.03k stars 23 forks source link

TypeError on run #2

Closed CCludts closed 7 years ago

CCludts commented 7 years ago

Trying this out, I got a TypeError on first try. specs:

image

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-91c61b03397a> in <module>()
----> 1 get_ipython().run_cell_magic('heat', '', 'def test():\n    50 * 50\n    1 + 2 \n    5 / 4')

C:\Users\User\Anaconda3\envs\poker\lib\site-packages\IPython\core\interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2113             magic_arg_s = self.var_expand(line, stack_depth)
   2114             with self.builtin_trap:
-> 2115                 result = fn(magic_arg_s, cell)
   2116             return result
   2117 

<decorator-gen-126> in heat(self, line, cell)

C:\Users\User\Anaconda3\envs\poker\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

C:\Users\User\Anaconda3\envs\poker\lib\site-packages\heat.py in heat(self, line, cell)
     49         tmp_file = 'ipython_cell_input.py'
     50         with open(tmp_file, 'wb') as f:
---> 51             f.write(cell)
     52 
     53         pyheat = PyHeat(tmp_file)

TypeError: a bytes-like object is required, not 'str'
mikejseay commented 7 years ago

I got the same issue.

screen shot 2017-08-19 at 8 56 57 am
csurfer commented 7 years ago

@PencilBow @mikejseay This is a known issue which is already fixed in v0.0.2 So updating the package version should resolve this for you. That reminds me that I should add a HISTORY file.