4

I am currently following the Python 3 Tutorial for Pywikibot and continue to experience attribute errors while running the included code from the tutorial as seen below.

import pywikibot

site = pywikibot.Site("en", "wikipedia")
page = pywikibot.Page(site, "Douglas Adams")
item = pywikibot.ItemPage.fromPage(page)

print(item)

While this is not the final step to achieve my goals, it has become a roadblock in my progression. From this code I should receive an output in the form of an ItemPage-object however I only receive the following error:

site = pywikibot.Site("en", "wikipedia")  # any site will work, this is just an example
AttributeError: module 'pywikibot' has no attribute 'Site'

I am quite new to programming and have only just scratched the surface, but I have taken some time to research attribute errors and how they may appear, as well as the fundamentals behind modules. At this point, however, I am pretty fried. Is it possible that my file/folder organization is causing this problem, or is there something more obvious that I am missing?

I am also wondering if I would be better off simply using a Wikipedia API to pull information and resources from Wikipedia/Wikidata for my project.

Thank you, please let me know if you need any more information.

KullideDev
  • 41
  • 1
  • 1
    Are you using python3 and have you installed pywikbot with pip3 ? – politinsa Dec 05 '19 at 14:04
  • Yes, I am currently using Python 3.7 and have pip installed pywikibot. I've followed the tutorial up until that point. – KullideDev Dec 06 '19 at 08:51
  • 1
    It seems you have not installed Pywikibot properly or you are missing some important step. To find out more, please share more details and tracebacks it gives you. – aleskva Dec 27 '19 at 19:44
  • 1
    It is weird, because you already successfully run the same lines in the previous tutorial pages. Perhaps also try to reinstall pywikibot – aleskva Dec 27 '19 at 19:46

0 Answers0