Page MenuHomePhabricator

Upload language screenshot files using commons_upload ruby gem
Closed, ResolvedPublic0 Story Points

Description

Something is wrong. :(

$ bundle exec upload
/usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:135:in `log_in': failed to log in with the returned token '86f12c9c4f34fb454cb74c34b78c5ce057bb1e82+\' (MediawikiApi::LoginError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:136:in `log_in'
	from /Users/z/Documents/github/amire80/commons_upload/lib/commons_upload.rb:42:in `images'
	from /Users/z/Documents/github/amire80/commons_upload/bin/upload:4:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.3.0/bin/upload:23:in `load'
	from /usr/local/lib/ruby/gems/2.3.0/bin/upload:23:in `<main>'
$ bundle exec upload
Uploading ./screenshots/VisualEditor_category_item-en.png
/usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:211:in `send_request': [V7seygpEEH8AADuOH00AAAAl] Exception Caught: Could not acquire lock for "Array". (internal_api_error_LocalFileLockError) (MediawikiApi::ApiError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:232:in `raw_action'
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:36:in `action'
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:166:in `upload_image'
	from /Users/z/Documents/github/amire80/commons_upload/lib/commons_upload.rb:34:in `image'
	from /Users/z/Documents/github/amire80/commons_upload/lib/commons_upload.rb:45:in `block in images'
	from /Users/z/Documents/github/amire80/commons_upload/lib/commons_upload.rb:43:in `each'
	from /Users/z/Documents/github/amire80/commons_upload/lib/commons_upload.rb:43:in `images'
	from /Users/z/Documents/github/amire80/commons_upload/bin/upload:4:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.3.0/bin/upload:23:in `load'
	from /usr/local/lib/ruby/gems/2.3.0/bin/upload:23:in `<main>'
$ gem list mediawiki_api
*** LOCAL GEMS ***
mediawiki_api (0.7.0)
mediawiki_api-wikidata (0.2.1)

$ irb

irb(main):001:0> require "mediawiki_api"
=> true

irb(main):002:0> client = MediawikiApi::Client.new "https://commons.wikimedia.beta.wmflabs.org/w/api.php"
=> #<MediawikiApi::Client:0x007fdd433aed00 @cookies=#<HTTP::CookieJar:0x007fdd433aecb0 @store=#<HTTP::CookieJar::HashStore:0x007fdd43387f48 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007fdd43387e80>, @logger=nil, @gc_threshold=150, @jar={}, @gc_index=0>>, @conn=#<Faraday::Connection:0x007fdd43387c00 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.9.2"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x007fdd43387840 @handlers=[Faraday::Request::Multipart, Faraday::Request::UrlEncoded, Faraday::CookieJar, FaradayMiddleware::FollowRedirects, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS https://commons.wikimedia.beta.wmflabs.org/w/api.php>, @proxy=nil>, @logged_in=false, @tokens={}>

irb(main):003:0> client.log_in "LanguageScreenshotBot", "not-the-real-one"
=> {"result"=>"Success", "lguserid"=>not-the-real-one, "lgusername"=>"LanguageScreenshotBot", "lgtoken"=>"not-the-real-one", "cookieprefix"=>"commonswiki", "sessionid"=>"not-the-real-one"}

irb(main):007:0> client.upload_image "VisualEditor_category_item-en.png", "./screenshots/VisualEditor_category_item-en.png", "test", true
MediawikiApi::ApiError: [V7sc6gpEEH8AAEa4PIwAAAAF] Exception Caught: Could not acquire lock for "Array". (internal_api_error_LocalFileLockError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:211:in `send_request'
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:232:in `raw_action'
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:36:in `action'
	from /usr/local/lib/ruby/gems/2.3.0/gems/mediawiki_api-0.7.0/lib/mediawiki_api/client.rb:166:in `upload_image'
	from (irb):7
	from /usr/local/bin/irb:11:in `<main>'

Event Timeline

Restricted Application added subscribers: Steinsplitter, Aklapper. · View Herald TranscriptAug 22 2016, 3:42 PM
zeljkofilipin moved this task from Backlog 🔙 to In Progress 🔨 on the User-zeljkofilipin board.
zeljkofilipin updated the task description. (Show Details)

Change 306222 had a related patch set uploaded (by Zfilipin):
WIP Upload language screenshot files using commons_upload Ruby gem

https://gerrit.wikimedia.org/r/306222

Change 306222 merged by jenkins-bot:
Upload language screenshot files using commons_upload Ruby gem

https://gerrit.wikimedia.org/r/306222

zeljkofilipin closed this task as Resolved.Aug 24 2016, 3:38 PM
Jdforrester-WMF set the point value for this task to 0.Aug 31 2016, 7:19 PM