Page MenuHomePhabricator

output redirection broken on windows
Closed, InvalidPublic

Description

\pywikibot-core> python -c "import pwb; import pywikibot; pywikibot.output(u'\u305d\u306e\u4e2d\u3067')" > file
その中で

this should be redirected to file, not printed to the console.

Event Timeline

valhallasw raised the priority of this task from to Needs Triage.
valhallasw updated the task description. (Show Details)
valhallasw added a project: Pywikibot.
valhallasw subscribed.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptMay 11 2015, 8:24 AM
jayvdb triaged this task as High priority.May 11 2015, 7:20 PM
jayvdb set Security to None.

The file is created but empty. Did it work in compat? (compat is not compatible with Python 3)

Xqt closed this task as Invalid.EditedNov 30 2021, 1:21 PM

The redirection work as follows:

py -c "import pywikibot; pywikibot.output('foo bar')" > file.txt 2>&1

which redirects stderr (2) to 1 (stdout) or using stdout directly:

py -c "import pywikibot; pywikibot.stdout('foo bar')" > file.txt

See: https://stackoverflow.com/questions/1420965/redirect-windows-cmd-stdout-and-stderr-to-a-single-file