Skip to content

win32ui: fix for correct init of sys.argv & CWD in sys.path (#1269 #1541)#1607

Merged
mhammond merged 1 commit intomhammond:masterfrom
kxrob:ide1
Nov 8, 2020
Merged

win32ui: fix for correct init of sys.argv & CWD in sys.path (#1269 #1541)#1607
mhammond merged 1 commit intomhammond:masterfrom
kxrob:ide1

Conversation

@kxrob
Copy link
Copy Markdown
Collaborator

@kxrob kxrob commented Nov 5, 2020

Several PythonWin startup issues.
And Win10 SDK download in CI seems unnecessary

@kxrob kxrob marked this pull request as ready for review November 6, 2020 13:42
Comment thread Pythonwin/pywin/framework/startup.py Outdated
Copy link
Copy Markdown
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll actually add support for CommandLineToArg now. So once I've pushed that, can you please rebase and squash your commits so there's only 1 with the detailed notes. I think this also deserves a note in CHANGES.txt

Comment thread Pythonwin/pywin/framework/startup.py Outdated
Comment thread .github/workflows/main.yml Outdated
@mhammond
Copy link
Copy Markdown
Owner

mhammond commented Nov 7, 2020

win32api.CommandLineToArgv has been checked in

@kxrob
Copy link
Copy Markdown
Collaborator Author

kxrob commented Nov 7, 2020

  • new win32api.CommandLineToArgv() used
  • a few more fixes: start_pythonwin.pyw, dde exec error with backslash paths -> use %r , no 2x error display in dde, flexible arg positions -new etc.
  • rebased & squashed

@kxrob kxrob requested a review from mhammond November 7, 2020 17:14
…1269 mhammond#1541)

* win32ui sets up sys.argv from commandline also upon
a pre-set empty list (which is different from ['']
meaning "no cmd line args"). Newer Python versions
(since 3.5 or so) had changed primoridal sys.argv
initialization. This also triggers correct sys.path
initialization with CWD or file arg directory by
PySys_SetArgv(Ex).

* IDE startup: fix and improve commandline handling:

Support dash arguments (-edit -new ..) instead of slashes ( /edit ).
Slashes caused invalid sys.path initialization: sys.path[0]
was 'C:\\' instead of CWD or dir of first file argument
after opening a file from Explorer ( "/edit FILENAME" )
for example.

Support opening of multiple files and a new -goto:LINENO option
(to be given after a filename).

Fix: Check if arg file for /edit exists before opening.
Otherwise Pythonwin would freeze on PY3.

Fix start_pythonwin.pyw for sys.argv + path standards.
@mhammond
Copy link
Copy Markdown
Owner

mhammond commented Nov 8, 2020

Thanks!

@mhammond mhammond merged commit fd1e69b into mhammond:master Nov 8, 2020
@kxrob kxrob deleted the ide1 branch March 1, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants