Skip to content
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

Forward slash character in path incorrectly rejected on Windows #3036

Closed
cfcurtis opened this issue Jul 30, 2024 · 5 comments
Closed

Forward slash character in path incorrectly rejected on Windows #3036

cfcurtis opened this issue Jul 30, 2024 · 5 comments
Assignees
Milestone

Comments

@cfcurtis
Copy link

Summary

Nuitka is now checking for illegal characters in specified paths, such as (in my case) using the --include-data-dirs option. However, this checking is overly restrictive, and prevents Python's cross-platform / conversion.

I believe the simple fix would be to remove the / character from the list of illegal characters defined here. I am happy to make this change and submit a PR, but I didn't want to jump to that as I'm not currently near a Windows computer for testing and wasn't sure if there were other implications.

Minimal reproducable sample

The following works on Linux, but would fail on Windows (my apologies for the bash syntax in file creation):

touch app.py
mkdir -p resources/locale
touch resources/locale/app.po
nuitka app.py --onefile --include-data-dir=resources/locale=resources/locale

You can see the output from my GitHub action with the actual files here. The relevant error message is:

Nuitka-Options: Used command line options: --onefile --include-data-dir=resources/locale=resources/locale --include-data-files=resources/stitcher-icon.ico=resources/stitcher-icon.ico --include-package-data=pdf_mangler --output-file=pdfstitcher.exe --windows-console-mode=disable --windows-icon-from-ico=resources/stitcher-icon.ico --assume-yes-for-downloads --output-dir=build --script-name=pdfstitcher/gui/app.py
Nuitka: Starting Python compilation with Nuitka '2.4.4' on Python '3.8' commercial grade 'not installed'.
FATAL: Error, cannot add data file with 'resources/locale\babel.cfg' path, as 'contains illegal character '/''

Relevant template questions and answers

  • Nuitka version, full Python version, flavor, OS, etc. as output by this exact command.

    python -m nuitka --version

    I am running the Nuitka Action on GitHub's hosted windows-2019. I am unable to run this exact command, but the following information was printed as part of the run:

    Collecting nuitka
    Cloning https://github.com/Nuitka/Nuitka.git/ (to revision main) to c:\users\runneradmin\appdata\local\temp\pip-install-jhfm3g1f\nuitka_626ff6d1289c462f94118c5d7b75e9d4
    Running command git clone --filter=blob:none --quiet https://github.com/Nuitka/Nuitka.git/ 'C:\Users\runneradmin\AppData\Local\Temp\pip-install-jhfm3g1f\nuitka_626ff6d1289c462f94118c5d7b75e9d4'
    Running command git checkout -b main --track origin/main
    branch 'main' set up to track 'origin/main'.
    Switched to a new branch 'main'
    Resolved https://github.com/Nuitka/Nuitka.git/ to commit c3b1c131c785553b582b362d5b1414d1000dff5d
    Running command git submodule update --init --recursive -q
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
    Requirement already satisfied: ordered-set>=4.1.0 in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (from nuitka) (4.1.0)
    Requirement already satisfied: zstandard>=0.15 in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (from nuitka) (0.20.0)
    Building wheels for collected packages: nuitka
      Building wheel for nuitka (pyproject.toml): started
      Building wheel for nuitka (pyproject.toml): finished with status 'done'
      Created wheel for nuitka: filename=Nuitka-2.4.4-cp38-cp38-win_amd64.whl size=3401016 sha256=3e28c03ea9838c3fc3a44159bc668968459bb73af28331a64c9e4e9eef0db5aa
      Stored in directory: C:\Users\runneradmin\AppData\Local\Temp\pip-ephem-wheel-cache-ukr1kc2m\wheels\[71](https://github.com/cfcurtis/pdfstitcher/actions/runs/10167847381/job/28121117326#step:5:74)\9e\d0\f505e86d3117e0b9bf4d57c59df42f91ea732fb3980b600661
    Successfully built nuitka
    Installing collected packages: nuitka
    Successfully installed nuitka-2.4.4
  • How did you install Nuitka and Python?

    Using GitHub actions, specifically:

    - name: Install Python
          uses: actions/setup-python@v5
          with:
            python-version: "3.8" # needs to be 3.8 to support Windows 7
    
    - uses: Nuitka/Nuitka-Action@main
          with:
            nuitka-version: main
  • Note if this is a regression

    Yes, this is a regression. The workflow successfully ran in June here

@KRRT7
Copy link
Contributor

KRRT7 commented Jul 30, 2024

If you'd like to make a PR, then
normalizing the path would be the way to go

@kayhayen
Copy link
Member

I am a git bash user myself and like the use of / to avoid quoting madness too. Also Windows normally just treats / in paths well in some places of Python, but not in the end.

@kayhayen kayhayen self-assigned this Jul 31, 2024
@kayhayen kayhayen added this to the 2.4 milestone Jul 31, 2024
@kayhayen
Copy link
Member

Thanks for your report, this is fixed on the factory branch, which is a development version under rapid development. You can try it out by going here: https://nuitka.net/doc/factory.html

Feedback on whether this is working is very welcome. Please do not share plans to do it; only confirm or deny that it is working.

@cfcurtis
Copy link
Author

Confirmed working on factory branch 2.5rc3!

@kayhayen
Copy link
Member

This is part of the latest hotfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants