correct way to specify windows python 3 only environment

Moritz Lürig's Avatar

Moritz Lürig

20 Oct, 2020 12:25 PM

Hi!

I have had successful CI builds with windows in the past on my project, but now I added "encoding='utf8'" and the build process breaks with "TypeError: 'encoding' is an invalid keyword argument for this function", because apparently python 2 is still imported (as mentioned here https://stackoverflow.com/a/12541521/5238559), and also visible from the warning "DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please..." in my project.

Now, I was under the impression that I specified that I only want python 3 to be loaded to the environment. Can someone tell me what's wrong with my appveyor.yml and my tox.ini:

appveyor.yml

```
branches:
  only:
    - master

environment:
  matrix:
  - TOXENV: py37
    PYTHON: "C:\\Python37-x64"
  
init:
  - "ECHO %TOXENV%"
  
build:
  off

install:
- "SET PATH=%PYTHON%; %PYTHON%\\Scripts; %PATH%"
- python -m pip install -U pip
- pip install tox

test_script:
- tox
```
ox.ini

```
[tox]
envlist = py37

[testenv]
passenv = APPVEYOR APPVEYOR_*
deps = .[test]
commands =
pytest -s --cov=phenopype --cov-report=html
- coveralls
```

  1. Support Staff 1 Posted by Feodor Fitsner on 21 Oct, 2020 05:01 AM

    Feodor Fitsner's Avatar

    Try this:

    branches: 
      only: 
        - master
    
    environment: 
      matrix: 
      - TOXENV: py37 
        PYTHON: C:\Python37-x64
       
    init: 
    - "ECHO %TOXENV%"
       
    build: 
      off
    
    install: 
    - SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%"
    - python --version
    - python -m pip install -U pip
    - pip install tox
    
    test_script: 
    - tox
    
  2. 2 Posted by moritz.luerig on 21 Oct, 2020 07:50 AM

    moritz.luerig's Avatar

    That fixed it – many thanks!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac