import pywikibot as pwb
from pywikibot import pagegenerators

site = pwb.Site("de","wikipedia")
cat = pwb.Category(site,'Bremen')
x=list(cat.articles(recurse=True))
#gen = pagegenerators.CategorizedPageGenerator(cat,recurse=-1)
for page in x:
    print(page.title(allowInterwiki = False))
import pywikibot as pwb
from pywikibot import pagegenerators

s = pwb.Site("de","wikipedia")
#cat = pwb.Category(s,'Bremen')
#x=list(cat.articles(recurse=True))
x = pagegenerators.PetScanPageGenerator(categories='Burglesum',site = s)
x = print(x.query())
for page in x:
    print(page)
    #print(page.title(allowInterwiki = False))
print('Ende erreicht')
<generator object PetScanPageGenerator.query at 0x7f537b5738e0>
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-24-1bb1fa7d85a5> in <module>()
      7 x = pagegenerators.PetScanPageGenerator(categories='Burglesum',site = s)
      8 x = print(x.query())
----> 9 for page in x:
     10     print(page)
     11     #print(page.title(allowInterwiki = False))

TypeError: 'NoneType' object is not iterable