gmailgem / gmail

A Rubyesque interface to Gmail, with all the tools you'll need.
Other
397 stars 119 forks source link

circular loading? loading in progress, circular require considered harmful - /usr/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/client #159

Closed ghost closed 4 years ago

ghost commented 9 years ago

Hi,

I think there is some circular thing going on.

/usr/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54: warning: loading in progress, circular require considered harmful - /usr/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/client/helper.rb

/usr/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/request_proxy/net_http.rb:69: warning: assigned but unused variable - auth_params /usr/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/consumer.rb:13: warning: File.exists? is a deprecated name, use File.exist? instead /usr/lib/ruby/gems/2.1.0/gems/gmail-0.5.0/lib/gmail/imap_extensions.rb:7: warning: method redefined; discarding old msg_att /usr/lib/ruby/2.1.0/net/imap.rb:2215: warning: previous definition of msg_att was here /usr/lib/ruby/gems/2.1.0/gems/gmail-0.5.0/lib/gmail/client/base.rb:60: warning: instance variable @logged_in not initialized /usr/lib/ruby/gems/2.1.0/gems/gmail-0.5.0/lib/gmail/client/base.rb:164: warning: instance variable @current_mailbox not initialized /usr/lib/ruby/gems/2.1.0/gems/gmail-0.5.0/lib/gmail/client/base.rb:60: warning: instance variable @logged_in not initialized /usr/lib/ruby/2.1.0/net/imap.rb:1158:in `get_tagged_response': Unknown command p7mb23717641eew (Net::IMAP::BadResponseError)

My code is essentially this:

require 'gmail'

Gmail.connect(USERNAME, PASSWORD) {|gmail|
  p gmail.inbox.count
  p gmail.inbox.count(:unread)
  p gmail.inbox.count(:read)
}

USERNAME and PASSWORD are my name and password.

Can you see what may be the problem?

johnnyshields commented 9 years ago

@shevegen it looks like the problem is on the last line:

/usr/lib/ruby/2.1.0/net/imap.rb:1158:in `get_tagged_response': Unknown command p7mb23717641eew (Net::IMAP::BadResponseError)

Everything else appears to be warnings.

johnnyshields commented 9 years ago

Also, were you using a previous version of Gmail (e.g. 0.4.2) where this worked properly?

johnnyshields commented 9 years ago

@shevegen can you please raise a PR which includes a test case which reproduces this error?

tjaklitsch commented 8 years ago

@johnnyshields @shevegen I'm getting the same error. This is my test case:

require 'gmail'

class Driver

    gmail = Gmail.new("emailaddress@gmail.com", "thepassword")
    p gmail.inbox.count
    gmail.logout

end

Where, obviously, the email and password are my gmail and password. I do not have two-factor enabled.

tjaklitsch commented 8 years ago

@johnnyshields Interesting - just got this email from Google:

Hi MYNAME,
Someone just tried to sign in to your Google Account ACCOUNTNAME from an app that doesn't meet modern security standards.
Details:
Sunday, May 15, 2016 3:57 PM (Eastern Daylight Time)
New York, NY, USA*
We strongly recommend that you use a secure app, like Gmail, to access your account. All apps made by Google meet these security standards. Using a less secure app, on the other hand, could leave your account vulnerable. Learn more.

Google stopped this sign-in attempt, but you should review your recently used devices:

REVIEW YOUR DEVICES NOW
Best,
The Google Accounts team
duanearnett commented 8 years ago

https://www.google.com/settings/u/3/security/lesssecureapps

@tjaklitsch You can enable less secure apps here if you need that to work. I believe gmail wants you to use device passwords though, but I haven't tested this yet.

johnnyshields commented 4 years ago

As of version 0.7.0 (Aug 19, 2018) this gem is officially deprecated and will no longer be maintained. Please instead use Google's official Gmail API Ruby Client, which uses the Gmail API rather than IMAP and has significantly better performance and reliability.