Dvorapa added a comment.
For me, both Python 2 and 3 works the same. Only the `read()` works just once
(as a stream), so better to copy the captured string.
name=Python 3.7
$ python pwb.py shell
Welcome to the Pywikibot interactive shell!
>>> from tests.utils import execute_pwb
tests: max_retries reduced from 15 to 1
>>> import io
>>> stream = execute_pwb(['hello'], data_in=chr(3), timeout=6)
>>> stderr = io.StringIO(stream['stderr'])
>>> print(stderr.read())
ERROR: hello.py not found! Misspelling?
NOTE: Starting the most similar script shell.py ***
in 5.0 seconds; type CTRL-C to stop.
Welcome to the Pywikibot interactive shell!
>>> print(stderr.read())
>>>
name=Python 2.7
$ pip2 install --user mock
DEPRECATION: Python 2.7 will reach the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 won't be maintained after that
date. A future version of pip will drop support for Python 2.7.
Collecting mock
Using cached
https://files.pythonhosted.org/packages/05/d2/f94e68be6b17f46d2c353564da56e6fb89ef09faeeff3313a046cb810ca9/mock-3.0.5-py2.py3-none-any.whl
Collecting funcsigs>=1; python_version < "3.3" (from mock)
Using cached
https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/lib/python2.7/site-packages
(from mock) (1.12.0)
Installing collected packages: funcsigs, mock
Successfully installed funcsigs-1.0.2 mock-3.0.5
$ python2 pwb.py shell
WARNING: /home/pavel/pywikibot/pywikibot/__init__.py:125: FutureWarning:
Python 2.7.16 will be dropped in 2020.
It is recommended to use Python 3.5 or above.
See T213287 for further information.
FutureWarning)
Welcome to the Pywikibot interactive shell!
>>> from tests.utils import execute_pwb
tests: max_retries reduced from 15 to 1
>>> import io
>>> stream = execute_pwb(['hello'], data_in=chr(3), timeout=6)
>>> stderr = io.StringIO(stream['stderr'])
>>> print(stderr.read())
ERROR: hello.py not found! Misspelling?
NOTE: Starting the most similar script shell.py ***
in 5.0 seconds; type CTRL-C to stop.
>>> print(stderr.read())
>>>
TASK DETAIL
https://phabricator.wikimedia.org/T224364
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt, Dvorapa
Cc: Dvorapa, Lokal_Profil, Dalba, Framawiki, Aklapper, Xqt,
pywikibot-bugs-list, Daryl-TTMG, RomaAmorRoma, E.S.A-Sheild, joker88john,
Viztor, DannyS712, CucyNoiD, NebulousIris, Wenyi, Gaboe420, Versusxo,
Majesticalreaper22, Giuliamocci, Adrian1985, Cpaulf30, Baloch007,
Darkminds3113, Bsandipan, Lordiis, Adik2382, Th3d3v1ls, Ramalepe, Liugev6,
Tbscho, MayS, WSH1906, Lewizho99, Mdupont, JJMC89, Maathavan, Altostratus,
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs