8000 cmd.bat (WPy64-3980) fails with syntax-error · Issue #1039 · winpython/winpython · GitHub
[go: up one dir, main page]

Skip to content
cmd.bat (WPy64-3980) fails with syntax-error #1039
@jcwinkler

Description

@jcwinkler

Steps to reproduce
In the following, it is assumed that WinPython is located at C:\Progs\WPy64-3980.

  • Open a Windows command prompt
  • Change into a directory outside of the WinPython installation location
  • Call C:\Progs\WPy64-3980\Scripts\cmd.bat
  • This results in a syntax error:
    grafik

Expected behaviour
The WinPython environment should have been set up successfully.

Reason
After some investigation it turns out that the problem is located in env_for_icons.bat and has been introduced by commit d5d7950

The syntax error is thrown here:

winpython/make.py

Lines 1382 to 1383 in e1b823e

rem remove some potential last \
if "%WINPYWORKDIR1:~-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-1%

There, %WINPYWORKDIR1:~-1% is expanded to a ", not \ or another allowed character as expected. This is since %WINPYWORKDIR1 is set in quotationsmarks now due to the commit mentioned above

winpython/make.py

Lines 1378 to 1379 in e1b823e

rem if it it launched from another directory , we keep it that one echo %__CD__%
if not "%__CD__%\"=="%~dp0" set WINPYWORKDIR1="%__CD__%"

Solution
I am not a Windows batch expert but I guess changing

winpython/make.py

Line 1383 in e1b823e

if "%WINPYWORKDIR1:~-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-1%

to

if "%WINPYWORKDIR1:~-2,-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-2%"

should fix the problem. I tested this on my systems (Windows 8.1 and Windows 10 21H1) and it works. However, I do not overlook all possible side effects. @stonebig If you agree with this approach I can make a PR.

Background
I call cmd.bat from a menu entry in my Windows Explorer context menu "Open WinPython 3.9 command prompt here...". This worked well for years (up to at least WPy64-3950), with WPy64-3980 the mentioned problems occured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0