Topic on Talk:Phabricator/Help

Jump to navigation Jump to search

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

3
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 pwb.py 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\imagetransfer.py:140: DeprecationWarning: pywikibot.page.FilePage.fileUrl 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 "pwb.py", line 299, in <module>
    if not main():
  File "pwb.py", line 294, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 96, in run_python_file
    main_mod.__dict__)
  File ".\scripts\imagetransfer.py", line 329, in <module>
    main()
  File ".\scripts\imagetransfer.py", line 325, in main
    bot.run()
  File ".\scripts\imagetransfer.py", line 273, in run
    self.transferImage(imagelist[todo])
  File ".\scripts\imagetransfer.py", 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)