On 3/25/20, Steve Barnes <gadgetst...@live.co.uk> wrote:
> Of course if, rather than creating symlinks, you create a batch file called
> python3.bat and containing the line:
> @py -3 %*

Batch scripts execute via cmd.exe, with an attached console, and when
Ctrl+C is typed they display a "Terminate batch job (Y/N)?" prompt
when cmd.exe resumes. This makes them a poor substitute for a link.

If the link is created beside "py.exe", it's better to use a relative
symlink. If the link is in another directory, use a shell link (i.e.
shortcut). Set the command to run as "C:\Windows\py.exe -3", or
wherever "py.exe" is installed. The shell API will pass command line
arguments. Clear the shortcut's "start in" field in order to inherit
the parent's working directory. Add ".LNK" to PATHEXT to be able to
run "python3" on the command line instead of requiring "python3.lnk".

> It is also worth mentioning that python (and the py launcher) both accept
> windows paths (\ separated) and *nix paths (/ separated) from the command
> line and that from within scripts the *nix path separator is to be preferred

That's generally true. Note however that the only reliable way to
access a path that exceeds MAX_PATH characters (260, or less depending
on context) is with a \\?\ extended path, which must use backslash.
(Python 3.6+ does support long normal paths in Windows 10, but this
capability has to be enabled at the system level. Plus many scripts
and applications still need to support Windows 7 and 8.)

An extended path is also required to open files with certain reserved
names such as DOS devices (e.g. "con" or "nul:.txt") and names that
end with spaces and dots (e.g. "spam. . ."). But please do not use an
extended path in order to assign reserved names. It just causes
needless problems.

> glob.glob("C:/Users/Gadget/Documents/*.docx") - the only real issue to avoid
> is the fact that Windows paths are case insensitive so names that differ
> only in case changes can & will collide.

A FAT32 filesystem is case insensitive in Unix (e.g. on a portable
drive), so this problem isn't limited to Windows. It's just more
common in Windows.

Also, an NTFS directory tree can be flagged as case sensitive in
Windows 10, but thankfully this isn't commonly used, even by
developers.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HHOB2HGK7AN7ZATWAS2GPBMN3CDOLGKY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to