Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching AttributeError when repr(fifo) that hasn't had fifo.write(frame) called yet #1130

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

ekalosak
Copy link
Contributor

@ekalosak ekalosak commented Jun 6, 2023

This change makes debugging state errors easier by describing to the user why the state is incomplete.

Before the change:

>>> AudioFifo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "av/audio/fifo.pyx", line 15, in av.audio.fifo.AudioFifo.__repr__
  File "av/audio/fifo.pyx", line 183, in av.audio.fifo.AudioFifo.sample_rate.__get__
AttributeError: 'NoneType' object has no attribute 'sample_rate'

After the change:

>>> AudioFifo()
<av.AudioFifo uninitialized, use fifo.write(frame), at 0x108719650>

@jlaine jlaine added the ready label Oct 31, 2023
@jlaine jlaine merged commit a26cda1 into PyAV-Org:main Oct 31, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants