Page MenuHomePhabricator

Can not upload a file
Closed, DuplicatePublic

Description

I can't upload a file to commons, I'm receiving this error: http://dpaste.com/1Y2TH0G

To upload I'm using this line: site.upload(page, 'refs.png', comment=u'update to %s' % useddump)

Event Timeline

Danilo created this task.Aug 29 2016, 10:00 PM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptAug 29 2016, 10:00 PM
Teles added a subscriber: Teles.Sep 2 2016, 5:37 PM
Sleeping for 7.3 seconds, 2016-08-29 17:55:47
ERROR: Traceback (most recent call last):
  File "/shared/pywikipedia/core/pywikibot/data/api.py", line 1954, in submit
    body=body, headers=headers)
  File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1417, in wrapper
    return obj(*__args, **__kw)
  File "/shared/pywikipedia/core/pywikibot/comms/http.py", line 279, in request
    r = fetch(baseuri, method, body, headers, **kwargs)
  File "/shared/pywikipedia/core/pywikibot/comms/http.py", line 434, in fetch
    error_handling_callback(request)
  File "/shared/pywikipedia/core/pywikibot/comms/http.py", line 352, in error_handling_callback
    raise request.data
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 678: ordinal not in range(128)

This looks really similar to T99366

@Danilo Wondering if the version of pywikibot you use is up to date.

Danilo added a comment.Oct 7 2016, 2:43 AM

I am using the pywikibot that is in Tool Labs, I put this in my env:
PYTHONPATH=/shared/pywikipedia/core:/shared/pywikipedia/core/scripts

And python /shared/pywikipedia/core/pwb.py version returns:
Pywikibot: [https] r-pywikibot-core.git (e6fc134, g2, 2016/10/05, 17:43:42, n/a)

I tested in my pc and I got upload to testwiki: https://test.wikipedia.org/wiki/File:Ptwiki_references.png

But when I try to upload at Tool Labs I still get the same error, and I need to run it in Tool Labs, because the script uses the history dumps there.