I have followed everone’s instuctions and I get more and more errors

D:\Development\python>python generate_family_file.py
Usage: %s <url> <short name>
Example: %s http://www.mywiki.bogus/wiki/Main_Page mywiki
This will create the file families/mywiki_family.py
Please insert URL to wiki: http://nintendo-cartridges-database.the-chronicles.o
g/wiki/Main_Page ncdb
Please insert a short name (eg: freeciv): ncdb
Generating family file from http://nintendo-cartridges-database.the-chronicles.
rg/wiki/Main_Page ncdb
Traceback (most recent call last):
  File "generate_family_file.py", line 256, in <module>
    FamilyFileGenerator(*sys.argv[1:]).run()
  File "generate_family_file.py", line 60, in run
    w = Wiki(self.base_url)
  File "generate_family_file.py", line 217, in __init__
    data = urlopen(fromurl).read()
  File "generate_family_file.py", line 21, in urlopen
    return urllib2.urlopen(req)
  File "D:\Development\python\lib\urllib2.py", line 124, in urlopen
    return _opener.open(url, data, timeout)
  File "D:\Development\python\lib\urllib2.py", line 383, in open
    response = self._open(req, data)
  File "D:\Development\python\lib\urllib2.py", line 401, in _open
    '_open', req)
  File "D:\Development\python\lib\urllib2.py", line 361, in _call_chain
    result = func(*args)
  File "D:\Development\python\lib\urllib2.py", line 1130, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "D:\Development\python\lib\urllib2.py", line 1103, in do_open
    r = h.getresponse()
  File "D:\Development\python\lib\httplib.py", line 950, in getresponse
    response.begin()
  File "D:\Development\python\lib\httplib.py", line 390, in begin
    version, status, reason = self._read_status()
  File "D:\Development\python\lib\httplib.py", line 354, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine

From: Bináris 
Sent: Thursday, December 23, 2010 2:35 PM
To: Pywikipedia discussion list 
Subject: Re: [Pywikipedia-l] setting my custom bot for my ncdb wiki

    File "D:\development\pymw\families\ncdb_family.py", line 152

       def version(self, code):
         ^
    IndentationError: expected an indented block



Look, I found the error for you in the pastebin.


  1..     def apipath(self, code):
  2..         # raise NotImplementedError, "%s wiki family does not support 
api.php" % self.name
  3..         # return '%s/api.php' % self.scriptpath(code)
  4.. 
  5..     # Which version of MediaWiki is used? REQUIRED
  6..     def version(self, code):
  7..         # Replace with the actual version being run on your wiki
  8..         return '1.16.0'
For some reasons, the numbering begins from 1 after copying, but it is at the 
given place. The previous function contains ONLY comments, therefore it is not 
accepted and you get an indentation error. But the real error is not in line 
152, it is in function apipath, which should contain at least one not-commented 
line. If you are sure that all this must be commented, then put a "pass" (empty 
instruction) in the apipath function, but I think that a function should return 
some value under any circumstances, that's why it is a function.



-- 
Bináris



--------------------------------------------------------------------------------
_______________________________________________
Pywikipedia-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
_______________________________________________
Pywikipedia-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to