Doing a sys.path.append(whatever) is uneffective when you have to schedule a python work (I tested it yersteday). The issue that Junaid indicated and the answer given is, in my mind, the only one for the moment.
Grimlock ----- Message d'origine ---- De : DeltaQuad <[email protected]> À : [email protected] Envoyé le : Ven 22 avril 2011, 19h 32min 02s Objet : Re: [Toolserver-l] Scheduling a pywikipedia bot >> I get the error: >> import wikipedia >> ImportError: No module named wikipedia >What are you using to "schedule" the bot? cron? You probably just need to set your PYTHONPATH somewhere. >For pywikipedia, this means that if your pywikipedia directory is at /home/user/scripts/pywikipedia, you'd put something like this in cron: >0 1 2 3 4 PYTHONPATH=$HOME/scripts/pywikipedia python $HOME/vandalize.py >If you're using qsub, you can set PYTHONPATH in an .environment file in your home directory. >There might be a purely Pythonic way to do this as well. Just google around a bit and you should be able to figure it out. >MZMcBride The Python way is: import sys #sys.path.append("C:\\pywikipedia\\") #Microsoft Windows #sys.path.append("/home/deltaquad/pywikipedia/pywikipedia") #Toolserver And I forget linux off the top of my head, but it's similar, just remove the first # on the one that applies to you. -------------------------- DeltaQuad http://enwp.org/User_Talk:DeltaQuad _______________________________________________ Toolserver-l mailing list ([email protected]) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette _______________________________________________ Toolserver-l mailing list ([email protected]) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
