-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os.startfile documentation should recommend not specifying the operation #94302
Labels
Comments
zooba
added a commit
to zooba/cpython
that referenced
this issue
Jul 29, 2022
zooba
added a commit
that referenced
this issue
Jul 29, 2022
Utumno
added a commit
to wrye-bash/wrye-bash
that referenced
this issue
Nov 1, 2023
As seen in https://github.com/python/cpython/blob/b14e882428ceda1e5852a1c22772e7f88927bded/Modules/clinic/posixmodule.c.h#L9807C1-L9807C1 the default for show_cmd is 1 which is then passed to ShellExecuteW (sic) in https://github.com/python/cpython/blob/cf6145453ff3a7bdc0790ac6d95b5b097c489d45/Modules/posixmodule.c#L12772 See also https://docs.python.org/3.11/library/os.html#os.startfile -- cwd is inherited which IIUC means we don't need to pass it See also python/cpython#94302 for "open" I removed FindExecutable logic - needs testing and some comments but I stash it here as actually Applauncher instances are rare - most are ExeLauncher exe_args better be just the args as seen
Utumno
added a commit
to wrye-bash/wrye-bash
that referenced
this issue
Nov 3, 2023
This finally decouples app_buttons from windows specific code. Note error handling centralized in App_Button sb_click which made more OldCodz redundant :) Under #368 for dropping setcw, made possible as its use was centralized. Still not clear how it's used could use a comment. shlex: Was args = f'"{self.exePath}"' vs ...exePath}" ' <- note space this seems fishy - I used shlex to do the join instead and used the full exe_args: @@ -1652,3 +1652,4 @@ def launch_app(self, exe_path, exe_args): cwd = _Path.getcwd() - args = f'"{exe_path}" ' ' '.join([f'{arg}' for arg in self.exeArgs]) # fixme use shlex? + args = shlex.join(exe_args) + executable = None try: in32api is only imported in env.windows (and bash.py) - a long term goal of #258 More shlex.split I think it's the right thing? see: https://discord.com/channels/537706885965676554/537710082755133460/1166274759957434388 for a complex cli passed from the ini where posix=false is needed Reinstate os.startfile in windows: As seen in https://github.com/python/cpython/blob/b14e882428ceda1e5852a1c22772e7f88927bded/Modules/clinic/posixmodule.c.h#L9807C1-L9807C1 the default for show_cmd is 1 which is then passed to ShellExecuteW (sic) in https://github.com/python/cpython/blob/cf6145453ff3a7bdc0790ac6d95b5b097c489d45/Modules/posixmodule.c#L12772 See also https://docs.python.org/3.11/library/os.html#os.startfile -- cwd is inherited which IIUC means we don't need to pass it See also python/cpython#94302 for "open" I removed FindExecutable logic - needs testing and some comments but I stash it here as actually Applauncher instances are rare - most are ExeLauncher (actually ony SoftimageModTool uses a bat) See discussion in: 5351c89 exe_args better be just the args without the exe path
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current documentation claims that
open
is the same as not specifying an operation, this is not true.open
forces the open verb/operation just like any other string forces that operation.open
is often the same as unspecified but it might not be.MSDN describes how the verb is resolved if
NULL
is passed toShellExecute
:The "default verb" is the string that can be set in
HKEY_CLASSES_ROOT\%progid%\shell
of the file type.NULL
needs to be passed to simulate double-clicking a file in Explorer...The text was updated successfully, but these errors were encountered: