https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
Bug ID: 72680 Summary: 'user-config.py' not found if runs with cron Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: l.rabinelli+bugzilla@gmail.com Web browser: --- Mobile Platform: ---
After Ic8ac542919e18ad16458d21e0f9713ade899b964 if I try to run a script via command line (foreground), it's executed correctly. Eg: python pwb.py <script_name> But when I schedule the same script via cron, it terminates with this error:
NOTE: 'user-config.py' was not found! Please follow the prompts to create it: Traceback (most recent call last): File "/data/project/betabot/core/pwb.py", line 162, in <module> []) File "/data/project/betabot/core/pwb.py", line 74, in run_python_file source = open(filename).read() IOError: [Errno 2] No such file or directory: 'generate_user_files.py'
This is my version: Pywikibot: [https] r-pywikibot-core.git (178e01a, g4377, 2014/10/26, 22:42:22, OUTDATED) Release version: 2.0b2 httplib2 version: 0.9 certificate test: ok Python: 2.7.3 (default, Feb 27 2014, 19:58:35) [GCC 4.6.3] unicode test: ok
Please, ask me if you need more information.
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jayvdb@gmail.com
--- Comment #1 from John Mark Vandenberg jayvdb@gmail.com --- Is your user-config.py in /data/project/betabot/core/ or in ~/.pywikibot ?
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
Fabian CommodoreFabianus@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |CommodoreFabianus@gmx.de
--- Comment #2 from Fabian CommodoreFabianus@gmx.de --- And do you use PYWIKIBOT2_DIR to define the directory. I'm not so knowledgable with cron, but it might not have PYWIKIBOT2_DIR set.
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
--- Comment #3 from Beta16 l.rabinelli+bugzilla@gmail.com --- (In reply to John Mark Vandenberg from comment #1)
Is your user-config.py in /data/project/betabot/core/ or in ~/.pywikibot ?
My user-config.py file is in /data/project/betabot/core/
(In reply to Fabian from comment #2)
And do you use PYWIKIBOT2_DIR to define the directory. I'm not so knowledgable with cron, but it might not have PYWIKIBOT2_DIR set.
I don't use environment variable PYWIKIBOT2_DIR
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
--- Comment #4 from Fabian CommodoreFabianus@gmx.de --- Okay this sounds like cron is not in the directory when it is executing pwb.py and it chooses the directory depending on where your console is at the moment.
I'm not sure if that is going to be fixed or how.
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |code-update-regression Blocks| |70936
--- Comment #5 from John Mark Vandenberg jayvdb@gmail.com --- This is reported to be a regression. Need to confirm that, and if so, fix it.
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugzilla.wikimedia. | |org/show_bug.cgi?id=72918
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
Merlijn van Deen valhallasw@arctus.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |valhallasw@arctus.nl
--- Comment #6 from Merlijn van Deen valhallasw@arctus.nl --- *** Bug 72918 has been marked as a duplicate of this bug. ***
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
--- Comment #7 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 172096 had a related patch set uploaded by Mpaa: Bug 72680 - 'user-config.py' not found if runs with cron
https://gerrit.wikimedia.org/r/172096
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
Steinsplitter steinsplitter@wikipedia.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |High CC| |steinsplitter@wikipedia.de Severity|normal |major
--- Comment #8 from Steinsplitter steinsplitter@wikipedia.de --- It breaks all bots with the newest version on toolslabs
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
--- Comment #9 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 172096 merged by jenkins-bot: Bug 72680 - 'user-config.py' not found if runs with cron
https://gerrit.wikimedia.org/r/172096
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
--- Comment #10 from Merlijn van Deen valhallasw@arctus.nl --- As a workaround, chdir to the pwb.py path before running, or explicitly define the user-config path with -dir:/path/where/pwb.py/is (or check out an older revision).
As far as I can see, the merged patch fixes this. The behaviour /is/ slightly different from before (the current working dir gets prevalence over the pwb.py directory) but this is by design.
https://bugzilla.wikimedia.org/show_bug.cgi?id=72680
Merlijn van Deen valhallasw@arctus.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED Resolution|--- |FIXED
pywikipedia-bugs@lists.wikimedia.org