simpleguitk icon indicating copy to clipboard operation
simpleguitk copied to clipboard

TypeError in sound.py

Open logogin opened this issue 10 years ago • 9 comments

File "/usr/local/lib/python2.7/site-packages/simpleguitk/sound.py", line 62, in load_sound return Sound(URL) File "/usr/local/lib/python2.7/site-packages/simpleguitk/sound.py", line 22, in init self._sound = pygame.mixer.Sound(io.BytesIO(soundfile)) TypeError: Unrecognized argument (type _io.BytesIO)

I guess the problem is in line 22: self._sound = pygame.mixer.Sound(io.BytesIO(soundfile)) should be something like: self._sound = pygame.mixer.Sound(io.BytesIO(soundfile).read())

pygame version 1.9.2a0 OSX 10.9.2

logogin avatar May 12 '14 15:05 logogin

Hi, pygame 1.9.1 seems to be the latest stable release and also the version provided by Homebrew. With 1.9.1 I'm unable to reproduce this issue and if I add .read() to io.BytesIO I get a TypeError instead.

dholm avatar May 15 '14 06:05 dholm

Installed pygame with pip pip install hg+http://bitbucket.org/pygame/pygame

logogin avatar May 15 '14 08:05 logogin

That would install the latest development version from their mercurial repository. Did you intentionally want to install a development version? I would expect most users to install the stable version (1.9.1).

If you intentionally wanted to use the development version then we need to figure out a way to tell them apart so that it will work with both stable and dev.

dholm avatar May 17 '14 14:05 dholm

It seems to work: self._sound = pygame.mixer.Sound(file = io.BytesIO(soundfile))

pingren avatar Nov 08 '14 14:11 pingren

@PalmerX I tried it but it just generates an exception:

Traceback (most recent call last):
  File "juicy_pong.py", line 61, in <module>
    bounce0 = load_sound("https://dl.dropboxusercontent.com/u/32888156/JuicyPong/Blip%20003.wav")
  File "../simpleguitk/simpleguitk/sound.py", line 62, in load_sound
    return Sound(URL)
  File "../simpleguitk/simpleguitk/sound.py", line 22, in __init__
    self._sound = pygame.mixer.Sound(file=io.BytesIO(soundfile))
TypeError: function takes exactly 1 argument (0 given)

dholm avatar Mar 07 '15 10:03 dholm

Do anyone has an update on this? Thanks!

htdinh avatar Dec 18 '16 17:12 htdinh

@Dinh-Hung-Tu Which version of pygame are you using?

dholm avatar Dec 25 '16 15:12 dholm

@dholm Hi David, I am using version 1.9.2.

htdinh avatar Dec 27 '16 16:12 htdinh

@Dinh-Hung-Tu Try using the HEAD version of simpleguitk and see if that resolves your issue.

dholm avatar Dec 30 '16 20:12 dholm