tag:help.appveyor.com,2012-11-13:/discussions/questions/50732-correct-way-to-specify-windows-python-3-only-environmentAppVeyor: Discussion 2020-10-21T07:50:13Ztag:help.appveyor.com,2012-11-13:Comment/487499212020-10-20T12:25:26Z2020-10-20T12:25:26Zcorrect way to specify windows python 3 only environment<div><p>Hi!</p>
<p>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 <a href="https://stackoverflow.com/a/12541521/5238559">https://stackoverflow.com/a/12541521/5238559</a>), and also visible from the warning "DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please..." in my project.</p>
<p>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:</p>
<p>appveyor.yml</p>
<pre>
<code>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</code>
</pre>
<p>ox.ini</p>
<pre>
<code>[tox]
envlist = py37
[testenv]
passenv = APPVEYOR APPVEYOR_*
deps = .[test]
commands =
pytest -s --cov=phenopype --cov-report=html
- coveralls</code>
</pre></div>Moritz Lürigtag:help.appveyor.com,2012-11-13:Comment/487499212020-10-21T05:01:14Z2020-10-21T05:01:14Zcorrect way to specify windows python 3 only environment<div><p>Try this:</p>
<pre>
<code>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</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/487499212020-10-21T07:50:12Z2020-10-21T07:50:12Zcorrect way to specify windows python 3 only environment<div><p>That fixed it – many thanks!</p></div>moritz.luerig