# Automatization API add\_analyzer blocks ad infinitum

**URL:** <https://discuss.saleae.com/t/automatization-api-add-analyzer-blocks-ad-infinitum/1956>\
**Category:** Logic 2 Software\
**Created:** [November 29, 2022, 12:16pm UTC](https://discuss.saleae.com/t/automatization-api-add-analyzer-blocks-ad-infinitum/1956 "2022-11-29T12:16:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![albert.caba](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@albert.caba](https://discuss.saleae.com/u/albert.caba)\
**Post date:** [November 29, 2022, 12:16pm UTC](https://discuss.saleae.com/t/automatization-api-add-analyzer-blocks-ad-infinitum/1956/1 "2022-11-29T12:16:48Z")

</div>

Hello,

The first time I execute the following script after starting up Logic 2 program , the code below works as expected. The second time it blocks forever in the add\_analyzer block. What could be the issue? Thanks!

```auto
		cls.manager = automation.Manager.connect(port=10430)

        device_configuration = automation.LogicDeviceConfiguration(
            enabled_digital_channels=digital_channels,
            digital_sample_rate=digital_baudrate_hz,
            enabled_analog_channels=analog_channels,
            analog_sample_rate=analog_baudrate_hz,
            #digital_threshold_volts=3.3,
        )

        if capture_seconds is None:
        # Record 5 seconds of data before stopping the capture
            capture_configuration = automation.CaptureConfiguration(
                #capture_mode=automation.TimedCaptureMode(duration_seconds=5.0)
            )
        else:
            capture_configuration = automation.CaptureConfiguration(
                capture_mode=automation.TimedCaptureMode(duration_seconds=capture_seconds)
            )

        cls.capture = cls.manager.start_capture(
                device_configuration=device_configuration,
                capture_configuration=capture_configuration)

        cls.capture.stop()

		########################################
		# Gets blocked below the second time: ##
		########################################
        analyzer1 = cls.capture.add_analyzer('1-Wire', label=f'test', settings={  
            '1-Wire': 0,
        })

        print("2")
        spi_analyzer = cls.capture.add_analyzer('SPI', label=f'WASKA', settings={
            'MISO': 0,
            'Clock': 1,
            'Enable': 2,
            'Bits per Transfer': '8 Bits per Transfer (Standard)'
        })

        capture_filepath = os.path.join(cls.output_path, 'example_capture.sal')
        cls.capture.save_capture(filepath=os.path.abspath(capture_filepath))

        cls.capture.remove_analyzer(analyzer1)
        cls.capture.remove_analyzer(spi_analyzer)

        cls.capture.close()
        cls.manager.close()

```

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [December 2, 2022, 6:39pm UTC](https://discuss.saleae.com/t/automatization-api-add-analyzer-blocks-ad-infinitum/1956/2 "2022-12-02T18:39:10Z")

</div>

@albert.caba Sorry for the trouble with this. At first glance at your code block, I’m unsure of what could be causing the script to get blocked. To quickly debug and reproduce this issue on our end, can you send your .py script file?
