In [3]: %memit np.ones(1e6)
---------------------------------------------------------------------------
PicklingError Traceback (most recent call last)
<ipython-input-3-be64cc0e5385> in <module>()
----> 1 get_ipython().magic(u'memit np.ones(1e6)')
c:\python27\lib\site-packages\IPython\core\interactiveshell.pyc in magic(self, arg_s)
2159 magic_name, _, magic_arg_s = arg_s.partition(' ')
2160 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2161 return self.run_line_magic(magic_name, magic_arg_s)Traceback (most recent call last):
2162
2163 File "<string>", line 1, in <module>
File "C:\Python27\lib\multiprocessing\forking.py", line 374, in main
self = load(from_parent)
File "C:\Python27\lib\pickle.py", line 1378, in load
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 858, in load
#-------------------------------------------------------------------------
c:\python27\lib\site-packages\IPython\core\interactiveshell.pyc in run_line_magic(self, magic_name, line)
dispatch[key](self)
File "C:\Python27\lib\pickle.py", line 880, in load_eof
raise EOFError
EOFError
2085 args.append(sys._getframe(stack_depth).f_locals)
2086 with self.builtin_trap:
-> 2087 result = fn(*args)
2088 return result
2089
<string> in memit(self, line, setup)
c:\python27\lib\site-packages\IPython\core\magic.pyc in <lambda>(f, *a, **k)
189 # but it's overkill for just that one bit of state.
190 def magic_deco(arg):
--> 191 call = lambda f, *a, **k: f(*a, **k)
192
193 if callable(arg):
<ipython-input-1-67ade5595dd2> in memit(self, line, setup)
59 for _ in xrange(repeat):
60 p = pr.Process(target=_get_usage, args=(stmt, setup, ns, q))
---> 61 p.start()
62 p.join()
63
C:\Python27\lib\multiprocessing\process.pyc in start(self)
128 else:
129 from .forking import Popen
--> 130 self._popen = Popen(self)
131 _current_process._children.add(self)
132
C:\Python27\lib\multiprocessing\forking.pyc in __init__(self, process_obj)
269 try:
270 dump(prep_data, to_child, HIGHEST_PROTOCOL)
--> 271 dump(process_obj, to_child, HIGHEST_PROTOCOL)
272 finally:
273 del Popen._tls.process_handle
C:\Python27\lib\multiprocessing\forking.pyc in dump(obj, file, protocol)
191
192 def dump(obj, file, protocol=None):
--> 193 ForkingPickler(file, protocol).dump(obj)
194
195 #
C:\Python27\lib\pickle.pyc in dump(self, obj)
222 if self.proto >= 2:
223 self.write(PROTO + chr(self.proto))
--> 224 self.save(obj)
225 self.write(STOP)
226
C:\Python27\lib\pickle.pyc in save(self, obj)
329
330 # Save the reduce() output and finally memoize the object
--> 331 self.save_reduce(obj=obj, *rv)
332
333 def persistent_id(self, obj):
C:\Python27\lib\pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
417
418 if state is not None:
--> 419 save(state)
420 write(BUILD)
421
C:\Python27\lib\pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
C:\Python27\lib\pickle.pyc in save_dict(self, obj)
647
648 self.memoize(obj)
--> 649 self._batch_setitems(obj.iteritems())
650
651 dispatch[DictionaryType] = save_dict
C:\Python27\lib\pickle.pyc in _batch_setitems(self, items)
679 for k, v in tmp:
680 save(k)
--> 681 save(v)
682 write(SETITEMS)
683 elif n:
C:\Python27\lib\pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
C:\Python27\lib\pickle.pyc in save_global(self, obj, name, pack)
746 raise PicklingError(
747 "Can't pickle %r: it's not found as %s.%s" %
--> 748 (obj, module, name))
749 else:
750 if klass is not obj:
PicklingError: Can't pickle <function _get_usage at 0x02B15EF0>: it's not found as __main__._get_usage