El archivo contiene datos en un formato desconocido (error de tiempo de ejecución)

I'm trying to build and run ruby code that a team member wrote for a class project.

Este es el error que recibo:

PS C:\users\bryan\Team6\PlanetDefense> ruby main.rb
C:/Ruby192/lib/ruby/gems/1.9.1/gems/gosu-0.7.41-x86-mingw32/lib/gosu/patches.rb:36:in
'initialize': File contains data in an unknown format. (RuntimeError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/gosu-0.7.41-x86-mingw32/lib/gosu/patches.rb:36:in `initialize'
    from C:/users/bryan/Team6/PlanetDefense/classes/playstate.rb:9:in `new'
    from C:/users/bryan/Team6/PlanetDefense/classes/playstate.rb:9:in `initialize'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:300:in `new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:300:in `game_state_instance'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:148:in `push_game_state'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/chingu-0.8.1/lib/chingu/helpers/game_state.rb:37:in `push_game_state'
    from main.rb:22:in `initialize'
    from main.rb:56:in `new'
    from main.rb:56:in `<main>'`

This appears to be the offending code:

class Gosu::Song
  alias initialize_ initialize

  def initialize(*args)
    args.shift if args.first.is_a? Gosu::Window
    initialize_(*args)
  end
end

Any ideas on what the "data in an unknown format" is? I've googled and can't come up with anything? Thanks for the help.

preguntado el 30 de enero de 12 a las 19:01

2 Respuestas

I found that the "data in an unknown format" was related to an mp3 file that gosu was trying to play. Commenting out code related to this resolved the error.

It's probably best not to use .mp3s in gosu right now, .wav is a better choice

Respondido 14 Feb 12, 23:02

Consulte nuestra página aquí for why this doesn't work in eg Windows but does on Mac. Instead of MP3 use the OGG format.

Respondido 19 Abr '14, 17:04

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.