Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'xml' referenced before assignment #355

Closed
nemobis opened this issue Feb 9, 2020 · 1 comment
Closed
Milestone

Comments

@nemobis
Copy link
Member

nemobis commented Feb 9, 2020

Analysing http://www.aroundisleofwight.info/api.php
Loading config file...
Resuming previous dump process...
Title list was completed in the previous session
XML is corrupt? Regenerating...
http://www.aroundisleofwight.info/api.php
    In attempt 1, XML for "Main_Page" is wrong. Waiting 20 seconds and reloading...
    In attempt 2, XML for "Main_Page" is wrong. Waiting 40 seconds and reloading...
    In attempt 3, XML for "Main_Page" is wrong. Waiting 60 seconds and reloading...
    In attempt 4, XML for "Main_Page" is wrong. Waiting 80 seconds and reloading...
    We have retried 5 times
    MediaWiki error for "Main_Page", network error or whatever...
    Trying to save only the last revision for this page...
    In attempt 1, XML for "Main_Page" is wrong. Waiting 20 seconds and reloading...
    In attempt 2, XML for "Main_Page" is wrong. Waiting 40 seconds and reloading...
    In attempt 3, XML for "Main_Page" is wrong. Waiting 60 seconds and reloading...
    In attempt 4, XML for "Main_Page" is wrong. Waiting 80 seconds and reloading...
    We have retried 5 times
    MediaWiki error for "Main_Page", network error or whatever...
    Saving in the errors log, and skipping...
Trying the local name for the Special namespace instead
    In attempt 1, XML for "Main_Page" is wrong. Waiting 20 seconds and reloading...
    In attempt 2, XML for "Main_Page" is wrong. Waiting 40 seconds and reloading...
    In attempt 3, XML for "Main_Page" is wrong. Waiting 60 seconds and reloading...
    In attempt 4, XML for "Main_Page" is wrong. Waiting 80 seconds and reloading...
    We have retried 5 times
    MediaWiki error for "Main_Page", network error or whatever...
    Trying to save only the last revision for this page...
    In attempt 1, XML for "Main_Page" is wrong. Waiting 20 seconds and reloading...
    In attempt 2, XML for "Main_Page" is wrong. Waiting 40 seconds and reloading...
    In attempt 3, XML for "Main_Page" is wrong. Waiting 60 seconds and reloading...
    In attempt 4, XML for "Main_Page" is wrong. Waiting 80 seconds and reloading...
    We have retried 5 times
    MediaWiki error for "Main_Page", network error or whatever...
    Saving in the errors log, and skipping...
Traceback (most recent call last):
  File "./dumpgenerator.py", line 2323, in <module>
    main()
  File "./dumpgenerator.py", line 2313, in main
    resumePreviousDump(config=config, other=other)
  File "./dumpgenerator.py", line 1966, in resumePreviousDump
    config=config, titles=titles, session=other['session'])
  File "./dumpgenerator.py", line 731, in generateXMLDump
    header, config = getXMLHeader(config=config, session=session)
  File "./dumpgenerator.py", line 508, in getXMLHeader
    header = xml.split('</mediawiki>')[0]
UnboundLocalError: local variable 'xml' referenced before assignment
tail: cannot open ‘aroundisleofwightinfo-20200208-wikidump/aroundisleofwightinfo-20200208-history.xml’ for reading: No such file or directory
No </mediawiki> tag found: dump failed, needs fixing; resume didn't work. Exiting.
@nemobis
Copy link
Member Author

nemobis commented Feb 10, 2020

The error in the subject can be fixed, but the specific wiki is broken, not our fault: http://www.aroundisleofwight.info/api.php?action=query&export=1&exportnowrap=1&titles=Main_page gives

<api servedby="server3.prescientsoftware.co.uk">
<error code="internal_api_error_MWException" info="Exception Caught: Internal error in ApiFormatRaw::getMimeType: No MIME type set for raw formatter" xml:space="preserve">
#0 /var/www/webapps/iow/includes/api/ApiBase.php(1111): wfDebugDieBacktrace('Internal error ...') #1 /var/www/webapps/iow/includes/api/ApiFormatRaw.php(56): ApiBase::dieDebug('ApiFormatRaw::g...', 'No MIME type se...') #2 /var/www/webapps/iow/includes/api/ApiFormatBase.php(140): ApiFormatRaw->getMimeType() #3 /var/www/webapps/iow/includes/api/ApiMain.php(689): ApiFormatBase->initPrinter(false) #4 /var/www/webapps/iow/includes/api/ApiMain.php(669): ApiMain->printResult(false) #5 /var/www/webapps/iow/includes/api/ApiMain.php(339): ApiMain->executeAction() #6 /var/www/webapps/iow/includes/api/ApiMain.php(323): ApiMain->executeActionWithErrorHandling() #7 /var/www/webapps/iow/api.php(104): ApiMain->execute() #8 {main}
</error>
</api>

@nemobis nemobis added this to the 0.4 milestone Feb 10, 2020
nemobis added a commit to nemobis/wikiteam that referenced this issue Feb 10, 2020
Avoid UnboundLocalError: local variable 'xml' referenced before assignment

If the page exists, its XML export is returned by the API; otherwise only
the header that we were looking for.

Fixes WikiTeam#355
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant