python-capturer icon indicating copy to clipboard operation
python-capturer copied to clipboard

Failure of CaptureOutput

Open artgoldberg opened this issue 4 years ago • 0 comments

CaptureOutput fails to initialize. Partial environment information: Mac OS, Python 3.8, and virtualenv. A colleague reports this problem. If I get more environment information I will add it.

Stack trace:

============================== FAILURES ===================================
____________________ TestSimulator.test_mem_use_measurement ____________________

self = <tests.test_simulator.TestSimulator testMethod=test_mem_use_measurement>

    def test_mem_use_measurement(self):
        self.make_one_object_simulation()
        max_time = 20
        config_dict = dict(max_time=max_time, output_dir=self.out_dir, object_memory_change_interval=10)
        self.simulator.simulate(config_dict=config_dict)
        expected_text = ['Memory use changes by SummaryTracker', '# objects', 'float']
        measurements = ''.join(open(self.measurements_pathname, 'r').readlines())
        for text in expected_text:
            self.assertIn(text, measurements)

        self.make_one_object_simulation()
>       with CaptureOutput(relay=False) as capturer:

tests/test_simulator.py:692: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.virtualenvs/desim/lib/python3.8/site-packages/capturer/__init__.py:276: in __enter__
    self.start_capture()
../../../.virtualenvs/desim/lib/python3.8/site-packages/capturer/__init__.py:328: in start_capture
    pseudo_terminal.start_capture()
../../../.virtualenvs/desim/lib/python3.8/site-packages/capturer/__init__.py:487: in start_capture
    self.start_child(self.capture_loop)
../../../.virtualenvs/desim/lib/python3.8/site-packages/capturer/__init__.py:153: in start_child
    child_process.start()
../../../.virtualenvs/desim/lib/python3.8/multiprocessing/process.py:121: in start
    self._popen = self._Popen(self)
../../../homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py:224: in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
../../../homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py:284: in _Popen
    return Popen(process_obj)
../../../homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py:32: in __init__
    super().__init__(process_obj)
../../../homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_fork.py:19: in __init__
    self._launch(process_obj)
../../../homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py:47: in _launch
    reduction.dump(process_obj, fp)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <Process name='Process-1' parent=78795 initial daemon>
file = <_io.BytesIO object at 0x121207a90>, protocol = None

    def dump(obj, file, protocol=None):
        '''Replacement for pickle.dump() using ForkingPickler.'''
>       ForkingPickler(file, protocol).dump(obj)
E       TypeError: cannot pickle '_io.BufferedReader' object

../../../homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/reduction.py:60: TypeError

artgoldberg avatar Sep 30 '20 15:09 artgoldberg