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

uninitialized constant Twitter::REST #878

Closed
cheater opened this issue Nov 9, 2017 · 37 comments
Closed

uninitialized constant Twitter::REST #878

cheater opened this issue Nov 9, 2017 · 37 comments

Comments

@cheater
Copy link

cheater commented Nov 9, 2017

Assuming this got fixed in #479 and reared its head due to some other issue now.

I literally only installed ruby 2.4, then did gem install t, and this is what happened.

Traceback:

/var/lib/gems/2.4.0/gems/t-3.1.0/lib/t/cli.rb:82:in `authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError)
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from /var/lib/gems/2.4.0/gems/t-3.1.0/bin/t:20:in `<top (required)>'
	from /usr/local/bin/t:23:in `load'
	from /usr/local/bin/t:23:in `<main>'

gem list says:

*** LOCAL GEMS ***

addressable (2.5.2)
bigdecimal (1.3.2, default: 1.3.0)
buftok (0.2.0)
domain_name (0.5.20170404)
equalizer (0.0.11)
geokit (1.11.0)
htmlentities (4.3.4)
http (3.0.0)
http-cookie (1.0.3)
http-form_data (2.0.0)
http_parser.rb (0.6.0)
io-console (default: 0.4.6)
json (2.1.0, default: 2.0.4)
launchy (2.4.3)
memoizable (0.4.2)
multipart-post (2.0.0)
naught (1.1.0)
oauth (0.5.3)
openssl (2.0.6, default: 2.0.5)
psych (2.2.4, default: 2.2.2)
public_suffix (3.0.1)
rdoc (5.1.0, default: 5.0.0)
retryable (2.0.4)
simple_oauth (0.3.1)
t (3.1.0)
thor (0.20.0)
thread_safe (0.3.6)
twitter (6.2.0)
unf (0.1.4)
unf_ext (0.0.7.4)

Not sure how to progress. Workarounds?

@cheater
Copy link
Author

cheater commented Nov 9, 2017

Tried this in ruby 2.1 as well, with same result.

@elliotblackburn
Copy link

I'm getting the same issue, not quite sure what to do either. My ruby version is ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16].

It seems to be failing to find a constant in the twitter library, it's looking in Twitter::REST::Client but from what I can see in the file - https://github.com/sferik/twitter/blob/d7951759da897e6a8e3ed0069b2e850470991e3f/lib/twitter/rest/client.rb it's not there. It seems to actually be in Twitter::REST::Request I believe?

@elliotblackburn
Copy link

Ah I see the issue - v6.1.0...v6.2.0 BASE_URL used to reside in that file but has been moved. So when Twitter 6.2.0 was released, versions of this are breaking.

Any chance someone could fix the version to 6.1.0 so this library will continue working? I'm not a huge ruby expert, you'd also need publish access.

@gtramontina
Copy link

Yeah, I guess if moving the constant out to a different location was a deliberate move, then this should be flagged as a breaking change, thus a major release should've been released. Got here from getting the same error when running a fresh install of https://github.com/sferik/t (gem install t).

I'd suggest unpublishing v6.2.0 (gem yank?) and republishing it as v7.0.0.

@sferik
Copy link
Owner

sferik commented Nov 18, 2017

I’m working on a fix for this issue now. Sorry for the trouble.

@elliotblackburn
Copy link

Thanks @sferik, looking forward to being able to use the CLI client 👍

@ghost
Copy link

ghost commented Nov 30, 2017

Thank you for working on this, waiting on it :D

@garybunofsky
Copy link

Patiently waiting for this fix as well. Thanks for working on it! 👍

@ghamarian
Copy link

Also waiting :-) Thanks!

@chrisvoncsefalvay
Copy link

Also waiting. Thanks for working on this! 👍

@vuiermark
Copy link

waiting here as well...thanks!

@cheater
Copy link
Author

cheater commented Dec 5, 2017

OK guys i know you're impatient but this nagging absolutely has to stop. I get retarded "bump" notifications every day. This isn't goddamn twitter. Go live out your ADHD over there. The guy obviously hasn't been on github since november - look at his activity - so what are you trying to achieve with this? He's busy with his real life (yeah, some people have one) and is going to get around to it... WHEN HE GETS AROUND TO IT. Stop nagging or I'll close the bug report!

@rvagg
Copy link

rvagg commented Dec 6, 2017

Here's your workaround folks: edit /Library/Ruby/Gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb, or maybe /Library/Ruby/Gems/*/gems/t-*/lib/t/cli.rb if you don't have that file. Replace the two instances of Twitter::REST::Client::BASE_URL with Twitter::REST::Request::BASE_URL and you're good to go.

@rdmarsh
Copy link

rdmarsh commented Dec 12, 2017

expanding on @rvagg: ubuntu 17.10, file was located at /var/lib/gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb

@hexwaxwing
Copy link

expanding on @rvagg: OS X 10.12.6 w/ rvm, file was located at ~/.rvm/gems/ruby-2.4.3/gems/t-3.1.0/lib/t/cli.rb

@DavidCWGA
Copy link

DavidCWGA commented Apr 25, 2018

rvagg's workaround doesn't work for me. The error changes to:

/var/lib/gems/2.3.0/gems/t-3.1.0/lib/t/rcfile.rb:89:in `profiles': undefined method `[]' for false:FalseClass (NoMethodError)

@jm3
Copy link

jm3 commented May 19, 2018

@sferik would love some help getting this fixed so i can use t again!

@fuzz
Copy link

fuzz commented May 29, 2018

It's not the prettiest solution, but if anyone just wants to get this working you can do it with bundler: Make a Gemfile with gem "t" and gem "twitter", "6.1.0", call bundle install and then run it with bundle exec t

@ialexs
Copy link

ialexs commented Jun 21, 2018

Also not the prettiest solution:
I copy the .twurlrc (from Twurl https://github.com/twitter/twurl) to .trc
then run t as usual.

cheers

@jasonhemann
Copy link

@fuzz or @ialexs, could either of you describe these two solutions in a little more detail?

I didn't see .twurlrc in the Twurl repo, and I don't know that I have bundle installed. I'm not familiar with that tool, and the name seems pretty Google-proof.

Thanks,

@DelphicOkami
Copy link

DelphicOkami commented Jun 29, 2018

@jasonhemann

  1. Go to https://apps.twitter.com/
  2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions
  3. Locally run gem install twurl
  4. Run twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}
  5. Follow the steps it requests that you do
  6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

@DelphicOkami
Copy link

The above totally worked for me

@cprkrn
Copy link

cprkrn commented Jul 11, 2018

Ah editing the cli.rb worked fine! Didn't realize there were two instances. Many thanks.

@kylejohnston
Copy link

The path to my cli.rb file was listed in the error message output after I entered my API keys (my path was different from the paths listed above).

Once I edited both instances of Twitter::REST::Request::BASE_URL, the installation completed.

@albill
Copy link

albill commented Jul 19, 2018

Really, this has been broken for eight months without a fix? WTH?

@eobrain
Copy link

eobrain commented Jul 23, 2018

Let's be nice here. This is a 12-year old open-source project. It is not unreasonable that the original maintainer might not jump in and fix bugs after all that time.

Anyone with Ruby skills and sufficient interest could contribute a fix. (I myself actually spent a little while freshening my rusty Ruby skills to see if I could fix this issue, but I just have not had time to devote to it.)

166 people have contributed to this repo over the years, so I suspect there are multiple people out there who would be able and willing to fix this.

@jm3
Copy link

jm3 commented Jul 24, 2018

@eobrain any suggestions for how best to appeal to some of those people?

@kennethreitz
Copy link

For those just running into this issue (like myself), this solution worked for me.

@thebitstick
Copy link

thebitstick commented Dec 14, 2018

Holy shit happy new year.
Also having this issue.
When is a fork coming to Rubygem that will be maintained, jesus.

@patwalls
Copy link

patwalls commented Apr 2, 2019

This bug totally sucks, spent a ton of time trying all these solutions and none worked. Are there any alternatives to the twitter ruby gem?

@cognitive137
Copy link

@jasonhemann

  1. Go to https://apps.twitter.com/
  2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions
  3. Locally run gem install twurl
  4. Run twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}
  5. Follow the steps it requests that you do
  6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

@jasonhemann

  1. Go to https://apps.twitter.com/
  2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions
  3. Locally run gem install twurl
  4. Run twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}
  5. Follow the steps it requests that you do
  6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file

I now get this error:

/Library/Ruby/Gems/2.3.0/gems/twurl-0.9.3/lib/twurl/cli.rb:94:in parse_options': invalid option: --8yZ1Sso8SKsPJG7F0BYMT62QG (OptionParser::InvalidOption) from /Library/Ruby/Gems/2.3.0/gems/twurl-0.9.3/lib/twurl/cli.rb:17:in run'
from /Library/Ruby/Gems/2.3.0/gems/twurl-0.9.3/bin/twurl:4:in <top (required)>' from /usr/local/bin/twurl:22:in load'
from /usr/local/bin/twurl:22:in `

'

@elliotblackburn
Copy link

@cognitive137 I think you should probably reset/delete that API key as it looks like it's been printed out in your error log there. (Editing your github comment will not remove it as there is a history of comments avalible). You should do this asap or someone may be able to use twitter as you 😢

@cognitive137
Copy link

@BlueHatbRit , thank you!

@DennisFaucher
Copy link

@jasonhemann

  1. Go to https://apps.twitter.com/
  2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions
  3. Locally run gem install twurl
  4. Run twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}
  5. Follow the steps it requests that you do
  6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

That's the fix! Many thanks @jasonhemann

@bnsv
Copy link

bnsv commented Dec 22, 2019

@jasonhemann

1. Go to https://apps.twitter.com/

2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions

3. Locally run `gem install twurl`

4. Run `twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}`

5. Follow the steps it requests that you do

6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

It's works for me too. You missing c on the last command (should be cp ~/.twurlrc ~/.trc). Thank you.

@BitumFelix
Copy link

Here's your workaround folks: edit /Library/Ruby/Gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb, or maybe /Library/Ruby/Gems/*/gems/t-*/lib/t/cli.rb if you don't have that file. Replace the two instances of Twitter::REST::Client::BASE_URL with Twitter::REST::Request::BASE_URL and you're good to go.

This worked for me too!
I was almost giving up.

@cmdrfletcher
Copy link

@jasonhemann

  1. Go to https://apps.twitter.com/
  2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions
  3. Locally run gem install twurl
  4. Run twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}
  5. Follow the steps it requests that you do
  6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

This is still working! Thanks! 👏

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