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

update_dict!': undefined method write' for File:Class (NoMethodError) #1

Open
OscarGodson opened this issue May 21, 2013 · 5 comments

Comments

@OscarGodson
Copy link

This looks pretty cool, but I'm getting this error:

bin $ ./flickr-authenticate
API Key: XXXXXXXXXXXXX
API Secret: XXXXXXXXXXXXX
Visit this URL in your browser: https://secure.flickr.com/services/oauth/authorize?oauth_token=72157633560816298-43c60b84122fc035&perms=delete
Paste the number given after logging in:
XXX-XXX-XXX
Authentication complete! Logged in as boozker.
Credentials saved!
{:api_key=>"XXXXXXXXXXXXX",
 :shared_secret=>"XXXXXXXXXXXXX",
 :access_token=>"XXXXXXXXXXXXX-XXXXXXXXXXXXX",
 :access_secret=>"XXXXXXXXXXXXX"}
bin $ ./flickr-store ~/Desktop/index.html
Please specify an action and file to store
bin $ ./flickr-store put ~/Desktop/index.html
/Users/oscar/Dropbox/projects/flickr-store/lib/flickr-store.rb:101:in `update_dict!': undefined method `write' for File:Class (NoMethodError)
    from /Users/oscar/Dropbox/projects/flickr-store/lib/flickr-store.rb:78:in `upload'
    from ./flickr-store:19:in `<main>'

Also, no idea why, maybe you have an idea, but I have to run these as shell scripts (./flickr-store) because even after doing gem install I get bash: flickr-authenticate: command not found.

@meltingice
Copy link
Owner

That's pretty weird, what version of Ruby are you running? Also, make sure your PATH is setup correctly to run and find gem executables.

@OscarGodson
Copy link
Author

Actually, no idea how, but the commands are being found in BASH now. Went to bed, woke up, and all of a sudden it can find them.

The errors tho still happen. It still uploads the files, but I get the following:

Desktop $ flickr-store put jake-proj/package.json
/Users/oscar/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/flickr-store-0.0.3/lib/flickr-store.rb:101:in `update_dict!': undefined method `write' for File:Class (NoMethodError)
    from /Users/oscar/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/flickr-store-0.0.3/lib/flickr-store.rb:78:in `upload'
    from /Users/oscar/.rbenv/versions/1.9.2-p320/lib/ruby/gems/1.9.1/gems/flickr-store-0.0.3/bin/flickr-store:19:in `<top (required)>'
    from /Users/oscar/.rbenv/versions/1.9.2-p320/bin/flickr-store:23:in `load'
    from /Users/oscar/.rbenv/versions/1.9.2-p320/bin/flickr-store:23:in `<main>'

Ruby info:

Desktop $ ruby -v
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin12.2.0]

@dekz
Copy link
Contributor

dekz commented May 26, 2013

It's weird mate, File::write should be inherited by IO (http://ruby-doc.org/core-1.9.3/IO.html#method-c-write). Does this happen every time you attempt to run this?

@OscarGodson
Copy link
Author

@dekz Yep. Never seen this error before :\

@dekz
Copy link
Contributor

dekz commented May 26, 2013

Oh I see it now, you're using 1.9.2 which doesn't seem to have File::write only File#write http://ruby-doc.org/core-1.9.2/IO.html#method-i-write. It should work if you update to a recent version of Ruby(1.9.3). Or we could refactor that code to open and then write.

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

3 participants