Bryan Glazer
Bryan Glazer

Reputation: 852

File contains data in an unknown format (Runtime Error)

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

This is the error that I'm getting:

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.

Upvotes: 3

Views: 4824

Answers (2)

peter
peter

Reputation: 42182

See here for why this doesn't work in eg Windows but does on Mac. Instead of MP3 use the OGG format.

Upvotes: 0

Bryan Glazer
Bryan Glazer

Reputation: 852

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

Upvotes: 2

Related Questions