Hello all,
*As several people have mentioned they had trouble starting with the rewrite branch, I decided to do a step-by-step log of installing the rewrite in a way that is good for developing -- this means you are able to edit the framework files, while not inflicting any changes on other users (or other bots you run!) of the system. By using setup.py develop, edits you make to the framework will immediately be used (no need to setup.py install them), but only within the virtualenv.*
*This is the windows version of my earlier email* * * I do not run python on windows, so this is a tutorial that starts with installing python. It's a bit rougher than the unix one, as I did not want to spend too much time on it.
1. Install python 2.7 http://python.org/ftp/python/2.7.1/python-2.7.1.msihttp://python.org/download/ (do *not* use the 64-bit version, due to http://bugs.python.org/issue6792 )
2. Install Setuptools http://pypi.python.org/pypi/setuptools#files
3. Install Virtualenv start/run: cmd c:\Python27\Scripts\easy_install.exe virtualenv
4. create a virtualenv for pwb C:\Users\valhallasw>c:\Python27\Scripts\virtualenv.exe pywikibot New python executable in pywikibot\Scripts\python.exe Installing setuptools.....................done.
5. Go to C:\Users\valhallasw\pywikibot and use tortoisesvn to get the rewrite
6. create a shortcut to cmd /k c:\users\valhallasw\pywikibot\scripts\activate.bat with working path C:\Users\valhallasw\pywikibot\rewrite
7. Use the shortcut. You now have a new cmd.exe window
8. python setup.py develop
Your default user directory is "C:\Users\valhallasw\AppData\Roaming\pywikibot" How to proceed? ([K]eep [c]hange)
change, to c:\users\valhallasw\pywikibot\conf\ Answer 'y' to the warning prompt (not 'yes')
Do you want to copy files: y [note: I copied my unix user-config.py to c:\users\valhallasw\pywikibot] Path to existing wikipedia.py? C:\Users\valhallasw\pywikibot NOTE: user-config.py already exists in the directory Create user-fixes.py file? ([y]es, [N]o) n
(pywikibot) C:\Users\valhallasw\pywikibot\rewrite>echo SET PYWIKIBOT2_DIR=c:\users\valhallasw\pywikibot\conf>> ..\Scripts\activate.bat
(DON'T put a space between f and >>!)
Close the window, and
9. Use the shortcut from (7) again
You should now have a cmd.exe with a working pywikibot setup!
(pywikibot) C:\Users\valhallasw\pywikibot\rewrite\scripts>python touch.py Gebruiker:Valhallasw Retrieving 1 pages from wikipedia:nl. Page [[Gebruiker:Valhallasw]] saved
NOTE: you *must* use 'python' in front of the script name, or python will not find the pywikibot directory.
Good luck!
Merlijn
Thanks for that guide. Unfortunately touch.py is the only script which runs in that environment. Other Scripts seems to hang. After ctrl-c I get this:
(rewrite) C:\pywikibot\rewrite\scripts>redirect.py double Configuration variable 'userinterface_lang' is defined but unknown. Misspelled? Configuration variable 'account_global' is defined but unknown. Misspelled? Configuration variable 'use_diskcache' is defined but unknown. Misspelled? Configuration variable 'notify_unflagged_bot' is defined but unknown. Misspelled ? Traceback (most recent call last): File "C:\pywikibot\rewrite\scripts\redirect.py", line 718, in <module> main() File "C:\pywikibot\rewrite\scripts\redirect.py", line 714, in main bot.run() File "C:\pywikibot\rewrite\scripts\redirect.py", line 630, in run self.fix_double_redirects() File "C:\pywikibot\rewrite\scripts\redirect.py", line 446, in fix_double_redir ects for redir_name in self.generator.retrieve_double_redirects(): File "C:\pywikibot\rewrite\scripts\redirect.py", line 292, in retrieve_double_ redirects in self.get_redirects_via_api(maxlen=2): File "C:\pywikibot\rewrite\scripts\redirect.py", line 209, in get_redirects_vi a_api for apiQ in self._next_redirect_group(): File "C:\pywikibot\rewrite\scripts\redirect.py", line 180, in _next_redirect_g roup for page in self.get_redirect_pages_via_api(): File "C:\pywikibot\rewrite\scripts\redirect.py", line 167, in get_redirect_pag es_via_api for p in gen: File "c:\pywikibot\rewrite\pywikibot\data\api.py", line 550, in __iter__ self.data = self.request.submit() File "c:\pywikibot\rewrite\pywikibot\data\api.py", line 272, in submit body=paramstring) File "c:\pywikibot\rewrite\pywikibot\comms\http.py", line 105, in request request.lock.acquire() File "C:\Python27\lib\threading.py", line 324, in acquire self.__cond.wait() File "C:\Python27\lib\threading.py", line 244, in wait waiter.acquire() KeyboardInterrupt
(rewrite) C:\pywikibot\rewrite\scripts>deactivate C:\pywikibot\rewrite\scripts>
Any suggestions?
Regards xqt
----- Original Nachricht ---- Von: Merlijn van Deen valhallasw@arctus.nl An: Pywikipedia discussion list pywikipedia-l@lists.wikimedia.org Datum: 18.02.2011 00:46 Betreff: [Pywikipedia-l] Running the rewrite branch as developer/power-user [windows]
Hello all,
*As several people have mentioned they had trouble starting with the rewrite branch, I decided to do a step-by-step log of installing the rewrite in a way that is good for developing -- this means you are able to edit the framework files, while not inflicting any changes on other users (or other bots you run!) of the system. By using setup.py develop, edits you make to the framework will immediately be used (no need to setup.py install them), but only within the virtualenv.*
*This is the windows version of my earlier email*
I do not run python on windows, so this is a tutorial that starts with installing python. It's a bit rougher than the unix one, as I did not want to spend too much time on it.
- Install python 2.7
http://python.org/ftp/python/2.7.1/python-2.7.1.msihttp://python.org/downlo ad/ (do *not* use the 64-bit version, due to http://bugs.python.org/issue6792 )
- Install Setuptools
http://pypi.python.org/pypi/setuptools#files
- Install Virtualenv
start/run: cmd c:\Python27\Scripts\easy_install.exe virtualenv
- create a virtualenv for pwb
C:\Users\valhallasw>c:\Python27\Scripts\virtualenv.exe pywikibot New python executable in pywikibot\Scripts\python.exe Installing setuptools.....................done.
- Go to C:\Users\valhallasw\pywikibot and use tortoisesvn to get the
rewrite
- create a shortcut to cmd /k
c:\users\valhallasw\pywikibot\scripts\activate.bat with working path C:\Users\valhallasw\pywikibot\rewrite
Use the shortcut. You now have a new cmd.exe window
python setup.py develop
Your default user directory is "C:\Users\valhallasw\AppData\Roaming\pywikibot" How to proceed? ([K]eep [c]hange)
change, to c:\users\valhallasw\pywikibot\conf\ Answer 'y' to the warning prompt (not 'yes')
Do you want to copy files: y [note: I copied my unix user-config.py to c:\users\valhallasw\pywikibot] Path to existing wikipedia.py? C:\Users\valhallasw\pywikibot NOTE: user-config.py already exists in the directory Create user-fixes.py file? ([y]es, [N]o) n
(pywikibot) C:\Users\valhallasw\pywikibot\rewrite>echo SET PYWIKIBOT2_DIR=c:\users\valhallasw\pywikibot\conf>> ..\Scripts\activate.bat
(DON'T put a space between f and >>!)
Close the window, and
- Use the shortcut from (7) again
You should now have a cmd.exe with a working pywikibot setup!
(pywikibot) C:\Users\valhallasw\pywikibot\rewrite\scripts>python touch.py Gebruiker:Valhallasw Retrieving 1 pages from wikipedia:nl. Page [[Gebruiker:Valhallasw]] saved
NOTE: you *must* use 'python' in front of the script name, or python will not find the pywikibot directory.
Good luck!
Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
pywikipedia-l@lists.wikimedia.org