On 12/19/2022 5:16 PM, Chris Angelico wrote:
On Tue, 20 Dec 2022 at 09:12, Thomas Passin <li...@tompassin.net> wrote:
FWIW, I once set up a Python installation so that it could run from a
USB stick (Windows only).  My launcher was a batch file that contained
the following:

@echo off
setlocal
: Find effective drive for this file.
set ed=%~d0
path %ed%\python37\Scripts;%ed%\python37;%PATH%
set PYTHONUSERBASE=%ed%\user\python
set HOME=%ed%\user\python
call python %*
endlocal


So much easier to do on a Unix-like system, where you don't need to
concern yourself with "effective drive" and can simply use relative
paths. I know we're not here to bash Windows, but... drive letters
really need to just die already.

Considering that this was for a removable drive, the launcher needed to know its own location, which might change from one instance to another. If you look at the code above, you won't find an obvious drive letter. You would need to do the equivalent on Linux. The Windows drive letter is just not relevant here.

(and I thought we weren't going keep on bashing non-preferred operating systems).

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to