import pywikibot
import re
from pywikibot import pagegenerators
site = pywikibot.Site()
page = pywikibot.Page(site, u"User:PearBOT/test")
text = page.text
templates=pywikibot.textlib.extract_templates_and_params(text,remove_disabled_parts="yes",strip = "yes")
for x in templates:
    print(x[0])
    if x[0] == "Aircraft specifications" or x[0] =="Aircraft specification" or x[0] == "Airtemp-test" or x[0] == "Airtemp-test" or x[0] == "aircraft specifications" or x[0] =="aircraft specification" or x[0] == "airtemp-test" or x[0] == "airtemp-test":
        parameters=x[1]
        print(x[1])
        if re.search(" (m|meter|metre|centimeter|centimeter|cm)",parameters.get("length main")):
            metric=true
            print("true")
        elif re.search(" (in|ft|inches|feet|foot|inch)",parameters.get("length main")):
            metric=false
            print("false")
        else:
            pywikibot.Page(site, u"User:PearBOT/Aircraft specs problems").text += "*Unknown prime unit at" + page.title 
            print("else")
        print(page.BasePage)
        print(metric)
#print(templates[2].get("plane or copter?"))
#page.text = text
#page.save(u"Bot test")
aircraft specifications
OrderedDict([('plane or copter?', 'copter'), ('jet or prop?', 'prop'), ('ref', 'Boeing CH-47D/F,<ref>{{cite web |url=http://www.boeing.com/defense/ch-47-chinook/#/technical-specifications |title=CH-47 Technical Specifications |publisher=Boeing |accessdate=19 March 2016 |archive-url=https://web.archive.org/web/20160313152930/http://www.boeing.com/defense/ch-47-chinook/#/technical-specifications |archive-date=13 March 2016 |dead-url=no }}</ref> Army Chinook file,<ref>{{cite web |url=http://www.army.mil/article/137584/ |title=CH-47 CHINOOK HELICOPTER |date=4 November 2014 |work=army.mil |accessdate=19 March 2016 |archive-url=https://web.archive.org/web/20160329054721/http://www.army.mil/article/137584 |archive-date=29 March 2016 |dead-url=no }}</ref> International Directory<ref name="Frawley Military">Frawley, Gerard: \'\'The International Directory of Military Aircraft\'\', p. 49. Aerospace Publications Pty Ltd, 2002. {{ISBN|1-875671-55-2}}.</ref>'), ('crew', 'three (pilot, copilot, flight engineer or loadmaster)'), ('capacity', "<br />\n** 33–55 troops ''or''\n** 24 [[Litter (rescue basket)|litters]] and 3 attendants ''or''"), ('payload main', '24,000&nbsp;lb'), ('payload alt', '10,886&nbsp;kg'), ('length main', '98&nbsp;ft 10&nbsp;in<ref name=Boeing_CH-47F>{{cite web|url=http://www.boeing.com/defense/ch-47-chinook/#/technical-specifications|title=Boeing: H-47 Chinook|website=www.boeing.com|access-date=19 March 2016|archive-url=https://web.archive.org/web/20160313152930/http://www.boeing.com/defense/ch-47-chinook/#/technical-specifications|archive-date=13 March 2016|dead-url=no}}</ref>'), ('length alt', "30.1&nbsp;m)\n* '''Fuselage length:''' 52&nbsp;ft (15.85&nbsp;m)\n* '''Fuselage width:''' 12 ft 5 in<ref name=Boeing_CH-47F/> (3.78 m"), ('span main', '60&nbsp;ft&nbsp;'), ('span alt', '18.3&nbsp;m'), ('height main', '18&nbsp;ft&nbsp;11&nbsp;in'), ('height alt', '5.7&nbsp;m'), ('area main', '5,600&nbsp;ft<sup>2</sup>'), ('area alt', '520&nbsp;m<sup>2</sup>'), ('empty weight main', '24,578&nbsp;lb'), ('empty weight alt', '11,148&nbsp;kg'), ('loaded weight main', ''), ('loaded weight alt', ''), ('max takeoff weight main', '50,000&nbsp;lb'), ('max takeoff weight alt', '22,680&nbsp;kg'), ('more general', ''), ('engine (prop)', '[[Lycoming T55|Lycoming T55-GA-714A]]'), ('type of prop', '[[turboshaft]]'), ('number of props', '2'), ('power main', '4,733&nbsp;[[horsepower|shp]]'), ('power alt', '3,529&nbsp;kW'), ('max speed main', '170&nbsp;[[knot (unit)|knots]]'), ('max speed alt', '196&nbsp;mph, 315&nbsp;km/h'), ('cruise speed main', '160&nbsp;kt'), ('cruise speed alt', '184&nbsp;mph, 296&nbsp;km/h'), ('stall speed main', ''), ('stall speed alt', ''), ('never exceed speed main', ''), ('never exceed speed alt', ''), ('range main', '400&nbsp;[[nautical mile|nmi]]'), ('range alt', '450&nbsp;mi, 741&nbsp;km'), ('combat radius main', '200&nbsp;nmi'), ('combat radius alt', '230 mi, 370&nbsp;km'), ('combat radius more', ''), ('ferry range main', '1,216&nbsp;nmi'), ('ferry range alt', "1,400&nbsp;mi, 2,252&nbsp;km<ref>United States of America. Naval Training Equipment Center. Department of the Navy. ''Recognition Study Cards – US and Foreign Aircraft''. Device 5E14H. LSN 6910-LL-C006462. Orlando, Florida. 1982. 55 Cards. '''Annotation''': 2252 kilometers.</ref>"), ('ferry range more', ''), ('ceiling main', '20,000&nbsp;ft'), ('ceiling alt', '6100&nbsp;m'), ('climb rate main', '1,522&nbsp;ft/min'), ('climb rate alt', '7.73&nbsp;m/s'), ('loading main', '9.5&nbsp;lb/ft<sup>2</sup>'), ('loading alt', '47&nbsp;kg/m<sup>2</sup>'), ('power/mass main', '0.28&nbsp;hp/lb'), ('power/mass alt', '460&nbsp;W/kg'), ('armament', '* Up to 3 pintle-mounted medium machine guns (1 on loading ramp and 2 at shoulder windows), generally 7.62&nbsp;mm (0.308&nbsp;in) [[M240 machine gun|M240]]/[[FN MAG]] machine guns, and can be armed with the 7.62&nbsp;mm [[Minigun|M134]] rotary machine gun'), ('avionics', '* Rockwell Collins Common Avionics Architecture System (CAAS) (MH-47G/CH-47F)')])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-80-e54cad7cc6bc> in <module>
     18             print("false")
     19         else:
---> 20             pywikibot.Page(site, u"User:PearBOT/Aircraft specs problems").text += "*Unknown prime unit at" + page.title
     21             print("else")
     22         print(page.BasePage)

TypeError: must be str, not method