Skip to content

E722 (no empty except) in powderpattern.py, and ax.draw() calls #57

@Tieqiong

Description

@Tieqiong

In powderpattern.py there are 4 occurrences of bear except statements. Not exactly sure which error type is expected, so added # noqa E722 for now to silence checkers.

While trying to figure it out, there are also two ax.draw() statements inside the try-except that looks a bit weird. For example in src/pyobjcryst/powderpattern.py:219-226:

            try:
                # Force immediate display. Not supported on all backends (e.g. nbagg)
                ax.draw()
                self._plot_fig.canvas.draw()
                if "ipympl" not in plt.get_backend():
                    plt.pause(0.001)
            except:  # noqa E722
                pass

For python=3.13 and matplotlib=3.10.3 the ax.draw() will directly give TypeError as draw() in Artist class requires renderer as parameter, which is not given here. Thus this try-except statement will always result in pass. However it seems like this will actually gives the expected behavior, according to descriptions in examples/structure-solution-powder-cimetidine.ipynb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions