Xqt created this task. Xqt added a subscriber: Xqt. Xqt added a project: pywikibot-core. Xqt changed Security from none to none.
TASK DESCRIPTION syntax for print statement has been changed few days ago: Traceback (most recent call last): File "C:\pwb\core\pwb.py", line 221, in <module> run_python_file(filename, argv, argvu, file_package) File "C:\pwb\core\pwb.py", line 80, in run_python_file exec(compile(source, filename, "exec"), main_mod.__dict__) File ".\scripts\vm-auto-erl-neu.py", line 553 print 'fertig'
SyntaxError: invalid syntax <type 'exceptions.SyntaxError'> CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
Pywikibot: pywikibot-core (398e7a8, s5826, 2014/12/19, 19:21:54, ok) Release version: 2.0b3 httplib2 version: 0.9 cacerts: C:\pwb\core\externals\httplib2\python2\httplib2\cacerts.txt certificate test: ok Python: 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] unicode test: ok PYWIKIBOT2_DIR: Not set PYWIKIBOT2_DIR_PWB: C:\pwb\core PYWIKIBOT2_NO_USER_CONFIG: Not set Config base dir: C:\pwb\core
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt Cc: Aklapper, Xqt, jayvdb, pywikipedia-bugs
jayvdb edited the task description.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: Aklapper, Xqt, jayvdb, pywikipedia-bugs
jayvdb closed this task as "Declined". jayvdb claimed this task. jayvdb added a comment.
It was changed here: Ic2443c17c9ad3976d654b2dd29201cfc12134322
'print x' is invalid in py3, and pwb supports py3
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: Aklapper, Xqt, jayvdb, pywikipedia-bugs
Xqt added a comment.
'print x' is invalid in py3, and pwb supports py3
That means pwb supports py3 only? Sorry where is this discussed?
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, Xqt Cc: Aklapper, Xqt, jayvdb, pywikipedia-bugs
valhallasw reopened this task as "Open". valhallasw added a subscriber: valhallasw. valhallasw added a comment.
Re-opening this. Pwb.py should not force scripts to be python 3 compatible. The situation here is that Xqt has a script (vm-auto-erl-neu.py), which is not Python 2 compatible. This is fine. Pwb.py should just run it.
I think the main cause is in the
from __future__ import print_function
that was added to pwb.py. Running a script through exec probably takes over that __future__ state.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, valhallasw Cc: Aklapper, Xqt, valhallasw, jayvdb, pywikipedia-bugs
valhallasw added a comment.
See https://www.python.org/dev/peps/pep-0236/ under 'Runtime compilation'.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, valhallasw Cc: Aklapper, Xqt, valhallasw, jayvdb, pywikipedia-bugs
jayvdb added a comment.
In https://phabricator.wikimedia.org/T85053#937672, @Xqt wrote:
'print x' is invalid in py3, and pwb supports py3
That means pwb supports py3 only? Sorry where is this discussed?
No, it doesnt mean that. We have regular builds on py2.6 and py2.7 to verify it works correctly.
https://travis-ci.org/wikimedia/pywikibot-core/builds
https://gerrit.wikimedia.org/r/#/c/173713/
"from __ future __ import print_function" helps identify py3 incompatible code in the library and scripts.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: Aklapper, Xqt, valhallasw, jayvdb, pywikipedia-bugs
Xqt added a comment.
Yes that code was (!) not py3 compatible and maybe there are other customized scripts which use py2 print statements and not py3 print function. Imho there is no need to have print_function imported. print("foo") works for both releases. And other py3 changes has also backported to py2.__future__ like division, unicode_literals, absolute_import. At least there should be a deprecate warning but imho we don't need print_function yet.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, Xqt Cc: Aklapper, Xqt, valhallasw, jayvdb, pywikipedia-bugs
XZise added a subscriber: XZise. XZise added a comment.
In theory yes but the print in line 218 is using the print_function functionality.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, XZise Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
valhallasw added a comment.
https://docs.python.org/2/library/functions.html#compile
compile(source, filename, mode[, flags[, dont_inherit]])
The optional arguments flags and dont_inherit control which future statements (see PEP 236) affect the compilation of source. If neither is present (or both are zero) the code is compiled with those future statements that are in effect in the code that is calling compile(). If the flags argument is given and dont_inherit is not (or is zero) then the future statements specified by the flags argument are used in addition to those that would be used anyway. If dont_inherit is a non-zero integer then the flags argument is it – the future statements in effect around the call to compile are ignored.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, valhallasw Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
Xqt added a subscriber: jayvdb. Xqt added a comment.
@XZise: The print_function my be imported before that print call @jayvdb: You may everything import from future inside libraries or inside framework scripts but you shouldn't do that in general while passing scripts through pwb.py which breaks customized scripts moreover without having communicated it previously. Btw what is with those script who are called directly without pwb.py if the framework is installed as side package?
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, Xqt Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
XZise added a comment.
@Xqt: `__future__` imports must be the first instruction.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, XZise Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
valhallasw added a comment.
In https://phabricator.wikimedia.org/T85053#937726, @Xqt wrote:
Btw what is with those script who are called directly without pwb.py if the framework is installed as side package?
They work without any problems: __future__ import are module-level. However, exec()ing a script means the script essentially runs //within the same module//, so the __future__ import in pwb.py is still used when parsing the script.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, valhallasw Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review. gerritbot added a comment.
Change 181247 had a related patch set uploaded (by Xqt): [BUGFIX] Do not inherit future statements from pwb.y
https://gerrit.wikimedia.org/r/181247
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, gerritbot Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 181247 merged by jenkins-bot: [BUGFIX] Do not inherit future statements from pwb.py
https://gerrit.wikimedia.org/r/181247
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, gerritbot Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
Xqt closed this task as "Resolved".
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, Xqt Cc: Aklapper, Xqt, valhallasw, XZise, jayvdb, pywikipedia-bugs
Ricordisamoa added a subscriber: Ricordisamoa.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, Ricordisamoa Cc: Ricordisamoa, Xqt, jayvdb, valhallasw, Aklapper, XZise, pywikipedia-bugs
Ricordisamoa removed a project: Patch-For-Review.
TASK DETAIL https://phabricator.wikimedia.org/T85053
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb, Ricordisamoa Cc: Ricordisamoa, Xqt, jayvdb, valhallasw, Aklapper, XZise, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org