Topic on Talk:Phabricator/Help

Jump to navigation Jump to search

Python 3.7: imagetransfer can only concat str (not "byte") to str

Summary by AKlapper (WMF)

Off-topic - This is for Phabricator. Please ask Pywikibot questions in a Pywikibot forum.

Chihaya~chan (talkcontribs)

I am using Python 3.7 and I tried to use imagetransfer but it returns error, for example:

>>> python imagetransfer "File:Rifle is Beautiful volume 1 cover.jpg" -tolang:vi -dir:en

0. Found image: File:Rifle is Beautiful volume 1 cover.jpg

Traceback (most recent call last):

WARNING: .\scripts\ DeprecationWarning: is deprecated for 3 years and 4 months; use get_file_url instead.
  url = sourceImagePage.fileUrl().encode('utf-8')

Traceback (most recent call last):
  File "", line 299, in <module>
    if not main():
  File "", line 294, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "", line 96, in run_python_file
  File ".\scripts\", line 329, in <module>
  File ".\scripts\", line 325, in main
  File ".\scripts\", line 273, in run
  File ".\scripts\", line 141, in transferImage
    pywikibot.output('URL should be: ' + url)
TypeError: can only concatenate str (not "bytes") to str
CRITICAL: Exiting due to uncaught exception <class 'TypeError'>

I also change url = sourceImagePage.fileUrl().encode('utf-8') to url = sourceImagePage.get_file_url().encode('utf-8') but still not working Any solution? Thanks a lot.

AKlapper (WMF) (talkcontribs)

This seems to be about "imagetransfer" (whatever that is) and not about Phabricator itself, hence closing this as off-topic. Please ask in a related support forum for whatever software you are referring to.

Framawiki (talkcontribs)