Page MenuHomePhabricator

not found pywikibot.specialbots module
Closed, InvalidPublic

Description

Using pywikibot on Labs (/shared/pywikipedia/core), multiple scripts that use UploadRobot() have errors:

in upload.py:

from pywikibot.specialbots import UploadRobot

ImportError: No module named pywikibot.specialbots

Temporary solution:

vi .bash_profile

add or modify:

export PYTHONPATH=/shared/pywikipedia/core_old:/shared/pywikipedia/core_old/externals/httplib2:/shared/pywikipedia/core_old/scripts

save, and input:

source .bash_profile

Event Timeline

Hi @Shizhao and thank You for this report,

Could You, please, provide informations how have You install pywikibot and on what version/changeset are right now?

Hi @Shizhao and thank You for this report,

Could You, please, provide informations how have You install pywikibot and on what version/changeset are right now?

see https://wikitech.wikimedia.org/wiki/User:Russell_Blau/Using_pywikibot_on_Labs

Magul triaged this task as Unbreak Now! priority.Nov 29 2016, 10:16 AM

@Shizhao could You retest it? I've just got tools lab access and and without more then

export PYTHONPATH=/shared/pywikipedia/core:/shared/pywikipedia/core/externals/httplib2:/shared/pywikipedia/core/scripts

I was able to

from pywikibot.specialbots import UploadRobot

Today retest, still ImportError

Could You, please, provide more details here?

It's working for me. My successful path looks like:

  • I have requested Tools Labs account here.
  • I uploaded my ssh key as described here.
  • After these steps I was able to login to ssh magul@login.tools.wmflabs.org.
  • I edited my .bash_profile file. The whole content of it looks like:
export PYTHONPATH=/shared/pywikipedia/core:/shared/pywikipedia/core/externals/httplib2:/shared/pywikipedia/core/scripts
  • I need to relogin to load new .bash_profile settings to shell.
  • After relogin command echo $PYTHONPATH returned:
/shared/pywikipedia/core:/shared/pywikipedia/core/externals/httplib2:/shared/pywikipedia/core/scripts
  • I starting python and executing commands (with output):
magul@tools-bastion-03:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/shared/pywikipedia/core', '/shared/pywikipedia/core/externals/httplib2', '/shared/pywikipedia/core/scripts', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']
>>> from pywikibot.specialbots import UploadRobot
>>>

Is Your rutine here somehow different?

Aklapper lowered the priority of this task from Unbreak Now! to Needs Triage.Jan 2 2017, 1:16 PM

No reply to T151850#2853024 for nearly a month hence removing "Unbreak Now!" priority.

Closing it as invalid, because there were no activity for over a month from @Shizhao and I was not able to reproduce it.