Page MenuHomePhabricator

config.py:1039: UserWarning: Configuration variable "Optional" is defined in your user-config.py but unknown. It can be a misspelled one or a variable that is no longer supported
Closed, ResolvedPublicBUG REPORT

Description

Command line:

python pwb.py redirect double

Output:

C:\Users\Mohammed\Downloads\core\pywikibot\config.py:1039: UserWarning:
Configuration variable "Optional" is defined in your user-config.py
but unknown. It can be a misspelled one or a variable that is no
longer supported.
  warn('\n' + fill('Configuration variable "{}" is defined in '
C:\Users\Mohammed\Downloads\core\pywikibot\config.py:1039: UserWarning:
Configuration variable "Union" is defined in your user-config.py but
unknown. It can be a misspelled one or a variable that is no longer
supported.
  warn('\n' + fill('Configuration variable "{}" is defined in '
C:\Users\Mohammed\Downloads\core\pywikibot\config.py:1039: UserWarning:
Configuration variable "List" is defined in your user-config.py but
unknown. It can be a misspelled one or a variable that is no longer
supported.
  warn('\n' + fill('Configuration variable "{}" is defined in '
C:\Users\Mohammed\Downloads\core\pywikibot\config.py:1039: UserWarning:
Configuration variable "Tuple" is defined in your user-config.py but
unknown. It can be a misspelled one or a variable that is no longer
supported.
  warn('\n' + fill('Configuration variable "{}" is defined in '
Retrieving double redirect special page...

What happens?:

  • This warning is shown whenever any script is run.
  • Deleting and recreating user-config.py does not fix the problem.
  • Related code is found here
  • Commenting out the following in my user-config.py
from typing import Optional, Union

from pywikibot.backports import Dict, List, Tuple

to be

#from typing import Optional, Union

from pywikibot.backports import Dict#, List, Tuple

solves this issue.

What should have happened instead?:

  • This warning shouldn't have been displayed.

Software version:

Pywikibot: [https] r-pywikibot-core (b5ade09, g18280, 2023/12/06, 17:03:29, master)
Release version: 9.0.0.dev0
setuptools version: 69.0.2
mwparserfromhell version: 0.6.5
wikitextparser version: n/a
requests version: 2.31.0
    certificate test: ok
Python: 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]

Event Timeline

This comment was removed by Xqt.

Change 981310 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Remove typing imports from user-config.py file

https://gerrit.wikimedia.org/r/981310

Xqt triaged this task as High priority.Dec 7 2023, 12:30 PM

Change 981310 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Remove typing imports from user-config.py file

https://gerrit.wikimedia.org/r/981310