jlund / spotify-export

A simple Ruby utility that uses Spotify's Web API to export a playlist as plain text
MIT License
293 stars 42 forks source link

undefined method `each' for nil:NilC #10

Closed LemADEC closed 7 years ago

LemADEC commented 8 years ago

When trying to use it on Windows, it appears a class is missing:

ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]

bundle install
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using arel 6.0.3
Using diff-lcs 1.2.5
Using rspec-support 3.4.1
Using ruby-progressbar 1.7.5
Using sqlite3 1.3.11
Using bundler 1.12.4
Using tzinfo 1.2.2
Using rspec-core 3.4.2
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using activesupport 4.2.5.1
Using rspec 3.4.0
Using activemodel 4.2.5.1
Using activerecord 4.2.5.1
Bundle complete! 4 Gemfile dependencies, 19 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Users\xxx\Documents\Daddy\_transfer\spotify-export-master>.\bin\spotify-export.rb "..\Discover weekly.txt"
C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:49:in `format_artists': undefined method `each' for nil:NilC
lass (NoMethodError)
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:82:in `get_track_attributes'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:32:in `attributes'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:22:in `name'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:23:in `block in <main>'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:20:in `each'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:20:in `each_with_index'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:20:in `<main>'

Did I mixup a version to use?

tommypyatt commented 8 years ago

I get the same error running on a Mac.

dancortes94 commented 8 years ago

I have the same mistake running on Mac.

robiXxu commented 7 years ago

same while running on mac..can we please have a fix ?

CorbanR commented 7 years ago

I'm running ruby 2.3.0 on OSX Sierra and it's working with no problems.

jlund commented 7 years ago

I couldn't figure out how to reproduce this at all, and then it dawned on me: "What if people are just hitting Ctrl-C (or Cmd-C) and copying Song Links instead of copying Spotify URIs?" That would be a pretty easy mistake to make if someone wasn't religiously following the instructions. Playlists of this variety resulted in exactly the same error.

I just added support for both formats, so this should be fixed. Export away!