Page MenuHomePhabricator

AttributeError: module 'pywikibot.config2' has no attribute 'LS'
Closed, InvalidPublic

Description

After svn update of pywikibot from R12566 to R12921 i got this message

AttributeError: module 'pywikibot.config2' has no attribute 'LS'

(used in cosmetic_changes.py, section cleansectionheaders)

i compared old code with actual and found that in pywikibot/config2 is missing section

# Define the line separator. Pages retrieved via API have "\n" whereas
# pages fetched from screen (mostly) have "\r\n". Interwiki and category
# separator settings in family files should use multiplied of this.
# LS is a shortcut alias.
line_separator = LS = '\n'

after adding bot works again

Event Timeline

Xqt triaged this task as High priority.

This is strange: I updated my SVN repository to that version noted above and get the same error but the cosmetic_changes.py file is different from git master. Line Separators where removed in rPWBC427a7d4 including that part in cosmetic_changes.py.

Xqt removed Xqt as the assignee of this task.Apr 30 2020, 12:29 PM
Xqt subscribed.

When updateing SVN I get the error messages "Skipped obstructing working copy …\core\pywikibot." I guess this is the reason for having this outdated file in my local repository. @JAnD: do you have something similar during SVN update?

Xqt raised the priority of this task from High to Needs Triage.Apr 30 2020, 12:52 PM

@JAnD: Pretty sure your repository is corrupt. Compare your cosmetic_changes.py with the current content at git/gerrit or https://github.com/wikimedia/pywikibot-core/ Try the following steps

  • Clean up... the repository and SVN update after that
  • SVN update for the pywikibot folder only
  • SVN update for each content inside pywikibot folder (tortoiseSVN is very useful here)
  • as last resort:
    • rename your current repository to save your private changes
    • make a new SVN checkout to the old Folder
    • copy your private files (user-config.py, user-fixes.py) and other unversioned files to your new repository if applicable
    • copy your data files to your new repository if applicable
    • copy your modified .py files from renamed folder to the new repository
    • SVN update your new repository to check whether it works
    • delete the renamed folder after a while if you don't need it anymore as backup

There is problem because my cosmetic_changes have additional sections (beautify infoboxes ,remove empty lines etc. ) which will lost after new instalation.

But I am afraid, this is not only problem of one file, I update bot occasionally (about two months) and it seems not all changes are included...

Your private changes aren’t a great problem with SVN due to its auto merge functionality. Just checkout a new working copy and copy your changed files from backup over this. Finally SVN update the repository which also merges your changes. Probably there may be conflicts to be solved with this step.