Problems with Python 3 venv on the windows-latest VM

Hi all,

I am trying to create a simple CICD pipeline for a Python 3.7+ project for Windows, and I am stuck at the beginning. :slight_smile:

My workflow file is this:

name: CI
on: [push]
jobs:
  build_windows:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - name: bootstrap
      run: tools/windows/bootstrap.bat

And here is my bootstrap.bat file:

curl -L -O https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
nuget.exe install python -Version 3.7.6
python.3.7.6\tools\python.exe -m venv venv
venv\Scripts\activate.bat
echo HELLO

Turns out, the moment  the command for activating the environment is run (venv\Scripts\activate.bat), the step finishes and nothing else in the script runs after that point. The line “echo HELLO” is never executed, or at least there is no output after that point. However, the job and workflow are executed successfully. Any idea why is this hapenning?

Thank you for your time.

PS1: I am not using the Python already installed on the VMs because of “reasons”.

PS2: Please excuse my ignorance in case I am doing something really wrong. I haven’t used Windows for many years. :slight_smile:

False alarm! :slight_smile: Turns out this is the expected behaviour of cmd. To fix my “issue” I need to call the activate script using “call”:

call venv\Scripts\activate.bat

Thaks! :slight_smile: