I have a MW 1.17 installation on my computer, and I ran * generate_family_file.py* as written in README-family.txt.
Output: Please insert URL to wiki: http://localhost/wiki Please insert a short name (eg: freeciv): local Generating family file from http://localhost/wiki *** WARNING: Api does not seem to be enabled on http://localhost/wiki Traceback (most recent call last): File "generate_family_file.py", line 261, 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 235, in __init__ self.server = self.REwgServer.search(data).groups()[0] AttributeError: 'NoneType' object has no attribute 'groups'
http://localhost/wiki/api.php gives me the same documentation page as in Wikipedia (note that it has wiki instead of w in URL). Why does it not find the API? And why does it terminate with this error?
2011/10/9 Bináris wikiposta@gmail.com
http://localhost/wiki/api.php gives me the same documentation page as in Wikipedia (note that it has wiki instead of w in URL).
Correction: it has NOTHING instead of /w, wiki is part of basic URL of my
wiki.
I think the problem is that my wiki is private and therefore needs to be logged in to use API. Perhaps generate_family_file.py is not prepared for handling private wikis.
I tried to create the family file manually, but I get the arror when running: You need read permission to use this module I got to the page http://www.mediawiki.org/wiki/API:Quick_start_guide#Logging_in Now I need help in completing user-config.py to log in. My user name is filled in, but the bot does not ask me for the password!
On 9 October 2011 12:53, Bináris wikiposta@gmail.com wrote:
I think the problem is that my wiki is private and therefore needs to be logged in to use API.
In that case, you will get a *different* error, not the one you posted. It would be interesting to know which one, so people who try to run generate_family_file.py on a private wiki get a slightly more sensible error.
Perhaps generate_family_file.py is not prepared for handling private wikis.
This is not what it was designed for, no. It needs the API to get certain variables that are hard to get otherwise. In addition, setting up authentication is not so easy, so I'm not sure if it is worth the effort.
If you're running locally, I would suggest turning 'private' on and off again. For on-line wikis, I don't think it's easy to provide a working generate_family_file.py. However, feel free to adapt the code, it's not that hard to work with.
I tried to create the family file manually, but I get the arror when running: You need read permission to use this module
Which probably means pywikipedia is not well suited to working on private wikis at the moment - which could be a serious bug, I guess. When running edit scripts, it tries to get some standard information without logging in (you can see what queries it sends by running the script with a -v flag) - things like messages and rights.
Maybe login.py /will/ work, as it has no reason to do much querying. If that also fails, please post the output of
python login.py -v (please check for private information, but there should be none)
and
python version.py
in a bug report.
Good luck!
Merlijn
Now I made some workaround. I created a separate bot user with bot and admin rights in order to avoid "You can't edit page" errors. I don't know where to set the edit permisson for unregistered bots.
With settings in localsettings.php: $wgGroupPermissions['*']['edit'] = true; $wgGroupPermissions['*']['read'] = true; and the dedicated bot user replace.py began to work correctly. It asked me for the password at last. Then I set it back to $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['read'] = false; and the bot previously logged in continued to work.
The mistake was that I should have explicitly run login.py -family:local before beginning botwork. For some reason the bot didn't ask for my password when the wiki was set to private, but it is possible that the reason was a config error in family file which I have corrected meanwhile; I don't know if these are connected or not. So my problem seems to be solved now! :-)
Thanks for the help and sorry for putting unnecessary questions.
On 9 October 2011 13:41, Bináris wikiposta@gmail.com wrote:
For some reason the bot didn't ask for my password when the wiki was set to private,
When running edit scripts, it tries to get some standard information without logging in (you can see what queries it sends by running the script with a -v flag) - things like messages and rights. As it is a private wiki, retrieving that information failed.
Running login.py does not query that information and therefore does work.
Best, Merlijn
On 9 October 2011 12:16, Bináris wikiposta@gmail.com wrote:
I have a MW 1.17 installation on my computer, and I ran
Why does it not find the API?
Because you did not svn up before trying this. MW 1.17 support was added almost three weeks ago.
And why does it terminate with this error?
Pre-1.17, there were a number of javascript variables (REwgServer, REwgScriptPath ) that could be parsed. These were removed in 1.17, and now the <link rel="EditURI"> tag is used.
Best, Merlijn
Thanks, Merlijn, that was my mistake. Now I created a family file manually, and I have the new question in the other mail.
pywikipedia-l@lists.wikimedia.org