I am trying to schedule a pywikipedia bot, but could not do it..
I get the error: import wikipedia ImportError: No module named wikipedia
How can I specify working directory for the program. I googled and tried several arguments but not worked. (It is first time I try to schedule a job)
Could someone help me?
Junaid P V wrote:
I am trying to schedule a pywikipedia bot, but could not do it..
I get the error: import wikipedia ImportError: No module named wikipedia
How can I specify working directory for the program. I googled and tried several arguments but not worked. (It is first time I try to schedule a job)
Could someone help me?
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
Like Like Like! I never figured out of to get pywikipedia to run automatically, and now my shell throws me a "disk quota exceeded" message. ¬¬
Diego
2011/4/22 MZMcBride z@mzmcbride.com
Junaid P V wrote:
I am trying to schedule a pywikipedia bot, but could not do it..
I get the error: import wikipedia ImportError: No module named wikipedia
How can I specify working directory for the program. I googled and tried several arguments but not worked. (It is first time I try to schedule a job)
Could someone help me?
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
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
Ive been using pywiki and cronie together without any issues. Diego you have used more harddrive space than you are allowed, du -h -d1 will give you a nice breakdown of where your space is. you only have 250mb by default
On Thu, Apr 21, 2011 at 11:49 PM, Diego Grez diegogrez@gmail.com wrote:
Like Like Like! I never figured out of to get pywikipedia to run automatically, and now my shell throws me a "disk quota exceeded" message. ¬¬
Diego
2011/4/22 MZMcBride z@mzmcbride.com
Junaid P V wrote:
I am trying to schedule a pywikipedia bot, but could not do it..
I get the error: import wikipedia ImportError: No module named wikipedia
How can I specify working directory for the program. I googled and tried several arguments but not worked. (It is first time I try to schedule a job)
Could someone help me?
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
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org) 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 (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
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
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 deltaquad@live.ca À : toolserver-l@lists.wikimedia.org 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 (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
Thank you John! That solved my problem!
2011/4/22 Grimlock grimlockfr@yahoo.fr
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 deltaquad@live.ca À : toolserver-l@lists.wikimedia.org 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 (Toolserver-l@lists.wikimedia.org) 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 (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
Grimlock grimlockfr@yahoo.fr wrote:
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.
Here's what I did:
willow$ head test/test.py lib/testlibrary.py ==> test/test.py <== #! /usr/bin/env python import sys, os sys.path.append(os.environ["HOME"] + "/lib") import testlibrary testlibrary.something()
==> lib/testlibrary.py <== def something(): print "Just done!"
willow$ chmod a+x test/test.py willow$ qsub test/test.py Your job 354713 ("test.py") has been submitted willow$ cat test.py.o354713 Just done!
Seems to be working fine...
//Marcin
Grimlock wrote:
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
The generic way to change the current working dir for a cron would be:
1 2 3 4 cd $HOME/scripts/pywikipedia && python $HOME/vandalize.py
On Fri, Apr 22, 2011 at 11:02 PM, DeltaQuad deltaquad@live.ca wrote:
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.
Thank you DeltaQuad
sys.path.append() helped me to solve the issue, it worked for me.
I was scheduling job with qsub
toolserver-l@lists.wikimedia.org