Ff300 created this task.
Ff300 added a project: Pywikibot-core.
Herald added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION

I tried this command to upload a file

python pwb.py upload -keep -noverify 'filename.jpg'  'description'

but it ended with the error

Traceback (most recent call last):
  File "pwb.py", line 251, in <module>
    if not main():
  File "pwb.py", line 244, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 115, in run_python_file
    main_mod.__dict__)
  File "./scripts/upload.py", line 206, in <module>
    main()
  File "./scripts/upload.py", line 200, in main
    chunk_size=chunk_size, always=always,
UnboundLocalError: local variable 'chunk_size' referenced before assignment
<type 'exceptions.UnboundLocalError'>
CRITICAL: Closing network session.

The same command with the flag -chunked worked fine. I'm using Python 2.7.14, pywikibot up to date with https://gerrit.wikimedia.org/r/pywikibot/core.git

I think the issue is in main in upload.py; this commit removed the chunk_size=0 and now chunk_size is assigned inside an if statement that is exectued only with the -chunked option.


TASK DETAIL
https://phabricator.wikimedia.org/T193386

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Ff300
Cc: Aklapper, Ff300, pywikibot-bugs-list, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, jayvdb, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to