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

TypeError in sound.py #3

Open
logogin opened this issue May 12, 2014 · 9 comments
Open

TypeError in sound.py #3

logogin opened this issue May 12, 2014 · 9 comments

Comments

@logogin
Copy link

logogin commented May 12, 2014

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

@dholm
Copy link
Owner

dholm commented May 15, 2014

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.

@logogin
Copy link
Author

logogin commented May 15, 2014

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

@dholm
Copy link
Owner

dholm commented May 17, 2014

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.

@pingren
Copy link

pingren commented Nov 8, 2014

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

@dholm
Copy link
Owner

dholm commented Mar 7, 2015

@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)

@htdinh
Copy link

htdinh commented Dec 18, 2016

Do anyone has an update on this? Thanks!

@dholm
Copy link
Owner

dholm commented Dec 25, 2016

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

@htdinh
Copy link

htdinh commented Dec 27, 2016

@dholm Hi David, I am using version 1.9.2.

dholm added a commit that referenced this issue Dec 30, 2016
Attempt to fix issue #3 by calling read on the BytesIO instance.
@dholm
Copy link
Owner

dholm commented Dec 30, 2016

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

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

No branches or pull requests

4 participants