Page MenuHomePhabricator

Win32 unicode argv contains arguments which is removed by Python's sys.argv
Closed, ResolvedPublic

Description

%PYTHON%\python -W error::UserWarning -m generate_user_files -family:test -lang:test -v
...
COMMAND: ['C:\\projects\\pywikibot-core\\generate_user_files.py', '-family:test', '-lang:test', '-v']
...
Unknown arguments: -m generate_user_files

The array after COMMAND: is sys.argv , whereas handle_args uses pywikibot.argvu[1:]

The unicode win32 argvu is obtained using GetCommandLineW and CommandLineToArgvW , which read the literal command line rather than the sys.argv value

The unicode win32 argvu does have code in pywikibot/userinterfaces/win32_unicode.py to handle -m , but it cant handle '-W error::UserWarning' before it.

The workaround is to remove the space between -W and error:...

%PYTHON%\python -Werror::UserWarning -m generate_user_files -family:test -lang:test -v

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb subscribed.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptMay 3 2015, 4:12 AM
jayvdb triaged this task as Low priority.May 3 2015, 4:14 AM
jayvdb updated the task description. (Show Details)
jayvdb set Security to None.
Xqt claimed this task.
Xqt subscribed.

Seems it was solved in meantime