Page MenuHomePhabricator

Pywikibot does no longer work in PAWS
Closed, InvalidPublicBUG REPORT

Description

Input:

Just one line in PAWS notebook

import pywikibot

Error message:

ImportError                               Traceback (most recent call last)
Cell In[5], line 1
----> 1 import pywikibot 

File /srv/paws/lib/python3.10/site-packages/pywikibot/__init__.py:21
     18 from urllib.parse import urlparse
     19 from warnings import warn
---> 21 from pywikibot import config as _config
     22 from pywikibot import exceptions
     23 from pywikibot.__metadata__ import __copyright__, __url__, __version__

File /srv/paws/lib/python3.10/site-packages/pywikibot/config.py:951
    949 elif OSWIN32 or _filemode & 0o02 == 0:
    950     with open(_filename, 'rb') as f:
--> 951         exec(compile(f.read(), _filename, 'exec'), _exec_globals)
    952 else:
    953     warning(f'Skipped {_filename!r}: writeable by others.')

File /srv/paws/user-config.py:9
      7 if os.path.exists(custom_path):
      8     with open(custom_path, "rb") as f:
----> 9         exec(compile(f.read(), custom_path, "exec"), globals())
     11     del f
     12 # Clean up temp variables, since pwb issues a warning otherwise
     13 # to help people catch misspelt config

File ~/user-config.py:6
      1 # This is an automatically generated file. You can find more
      2 # configuration parameters in 'config.py' file or refer
      3 # https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.config.html
      4 from typing import Optional, Union
----> 6 from pywikibot.backports import Dict, List, Tuple
      8 # The family of sites to be working on.
      9 # Pywikibot will import families/xxx_family.py so if you want to change
     10 # this variable, you have to ensure that such a file exists. You may use
     11 # generate_family_file to create one.
     12 family = 'wikipedia'

ImportError: cannot import name 'List' from 'pywikibot.backports' (/srv/paws/lib/python3.10/site-packages/pywikibot/backports.py)

Event Timeline

JJMC89 closed this task as Invalid.EditedApr 14 2024, 6:30 PM
JJMC89 subscribed.

This sound like you have some outdated version of pywikibot installed or on your path.

image.png (289×336 px, 12 KB)

Your ~/user-config.py has from pywikibot.backports import Dict, List, Tuple.