boodler-redux icon indicating copy to clipboard operation
boodler-redux copied to clipboard

--testsound doesn't work under Python 3.8.10 or 3.9.6

Open seanlynch opened this issue 4 years ago • 1 comments

I get the following traceback when trying to run boodler --testsound with Python 3.9.6 or 3.8.10.

$ boodler --testsound
13:10:08 (root) collection directory does not exist: /home/seanl/.boodler/Collection
13:10:08 (root) Running "Boodler test sound"
--- Logging error ---
Traceback (most recent call last):
  File "/home/seanl/.pyenv/versions/soundscape/lib/python3.8/site-packages/boodle/generator.py", line 873, in run_agents
    handle()
  File "/home/seanl/.pyenv/versions/soundscape/lib/python3.8/site-packages/boodle/builtin.py", line 224, in run
    snd = TestSoundAgent.getsound()
  File "/home/seanl/.pyenv/versions/soundscape/lib/python3.8/site-packages/boodle/builtin.py", line 213, in getsound
    TestSoundAgent.makesound(fl)
  File "/home/seanl/.pyenv/versions/soundscape/lib/python3.8/site-packages/boodle/builtin.py", line 200, in makesound
    afl.writeframes(dat)
  File "/usr/lib/python3.8/aifc.py", line 736, in writeframes
    self.writeframesraw(data)
  File "/usr/lib/python3.8/aifc.py", line 726, in writeframesraw
    data = memoryview(data).cast('B')
TypeError: memoryview: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/__init__.py", line 1085, in emit
    msg = self.format(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 929, in format
    return fmt.format(record)
  File "/home/seanl/.pyenv/versions/soundscape/bin/boodler", line 224, in shortFormat
    res = logging.Formatter.format(self, rec)
  File "/usr/lib/python3.8/logging/__init__.py", line 676, in format
    record.exc_text = self.formatException(record.exc_info)
  File "/home/seanl/.pyenv/versions/soundscape/bin/boodler", line 248, in formatException
    notboodle = isinstance(tup[1], boodle.BoodlerError) or isinstance(
AttributeError: module 'boodle' has no attribute 'BoodlerError'
Call stack:
  File "/home/seanl/.pyenv/versions/soundscape/bin/boodler", line 413, in <module>
    cboodle.loop(generator.run_agents, gen)
  File "/home/seanl/.pyenv/versions/soundscape/lib/python3.8/site-packages/boodle/generator.py", line 875, in run_agents
    ag.logger.error('%s: %s', ex.__class__.__name__, ex, exc_info=True)
Message: '%s: %s'
Arguments: ('TypeError', TypeError("memoryview: a bytes-like object is required, not 'str'"))
Exception ignored in: <function Aifc_write.__del__ at 0x7f7e9c9b1820>
Traceback (most recent call last):
  File "/usr/lib/python3.8/aifc.py", line 593, in __del__
    self.close()
  File "/usr/lib/python3.8/aifc.py", line 745, in close
    self._ensure_header_written(0)
  File "/usr/lib/python3.8/aifc.py", line 795, in _ensure_header_written
    self._write_header(datasize)
  File "/usr/lib/python3.8/aifc.py", line 808, in _write_header
    self._file.write(b'FORM')
TypeError: string argument expected, got 'bytes'

seanlynch avatar Jul 24 '21 20:07 seanlynch

Same here with Python 3.10

$ python --version
Python 3.10.9
$ pip install boodler-redux
Defaulting to user installation because normal site-packages is not writeable
Collecting boodler-redux
  Downloading boodler-redux-3.0.0.tar.gz (277 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 277.0/277.0 kB 609.6 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: packaging in /usr/lib/python3.10/site-packages (from boodler-redux) (23.0)
Building wheels for collected packages: boodler-redux
  Building wheel for boodler-redux (setup.py) ... done
  Created wheel for boodler-redux: filename=boodler_redux-3.0.0-cp310-cp310-linux_x86_64.whl size=179975 sha256=028cfc3c8a8e597c6d11cfad5ba567cf02016703374342f29f9e9e2e51a2fa95
  Stored in directory: /home/moses/.cache/pip/wheels/46/11/a2/8b7498827b95102603dc90252b0fbd237a502591dfc198f633
Successfully built boodler-redux
Installing collected packages: boodler-redux
Successfully installed boodler-redux-3.0.0

then

$ boodler --testsound
19:25:20 (root) Running "Boodler test sound"
--- Logging error ---
Traceback (most recent call last):
  File "/home/moses/.local/lib/python3.10/site-packages/boodle/generator.py", line 873, in run_agents
    handle()
  File "/home/moses/.local/lib/python3.10/site-packages/boodle/builtin.py", line 224, in run
    snd = TestSoundAgent.getsound()
  File "/home/moses/.local/lib/python3.10/site-packages/boodle/builtin.py", line 213, in getsound
    TestSoundAgent.makesound(fl)
  File "/home/moses/.local/lib/python3.10/site-packages/boodle/builtin.py", line 200, in makesound
    afl.writeframes(dat)
  File "/usr/lib/python3.10/aifc.py", line 736, in writeframes
    self.writeframesraw(data)
  File "/usr/lib/python3.10/aifc.py", line 726, in writeframesraw
    data = memoryview(data).cast('B')
TypeError: memoryview: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/home/moses/.local/bin/boodler", line 224, in shortFormat
    res = logging.Formatter.format(self, rec)
  File "/usr/lib/python3.10/logging/__init__.py", line 686, in format
    record.exc_text = self.formatException(record.exc_info)
  File "/home/moses/.local/bin/boodler", line 248, in formatException
    notboodle = isinstance(tup[1], boodle.BoodlerError) or isinstance(
AttributeError: module 'boodle' has no attribute 'BoodlerError'
Call stack:
  File "/home/moses/.local/bin/boodler", line 413, in <module>
    cboodle.loop(generator.run_agents, gen)
  File "/home/moses/.local/lib/python3.10/site-packages/boodle/generator.py", line 875, in run_agents
    ag.logger.error('%s: %s', ex.__class__.__name__, ex, exc_info=True)
Message: '%s: %s'
Arguments: ('TypeError', TypeError("memoryview: a bytes-like object is required, not 'str'"))
Exception ignored in: <function Aifc_write.__del__ at 0x7fc1c41a12d0>
Traceback (most recent call last):
  File "/usr/lib/python3.10/aifc.py", line 593, in __del__
    self.close()
  File "/usr/lib/python3.10/aifc.py", line 745, in close
    self._ensure_header_written(0)
  File "/usr/lib/python3.10/aifc.py", line 795, in _ensure_header_written
    self._write_header(datasize)
  File "/usr/lib/python3.10/aifc.py", line 808, in _write_header
    self._file.write(b'FORM')
TypeError: string argument expected, got 'bytes'

mozai avatar Mar 12 '23 00:03 mozai