aydjay
aydjay

Reputation: 868

Teamcity agent default python

I have a java build that uses python to handle some of the configuration. I have build agents on both windows and linux. On windows I have place python 3 in my path so that i can issue python commands as part of my build.

When the agent is running on linux it is picking up python2 instead of python3.

How do I default the teamcity agent to python 3

Upvotes: 0

Views: 2680

Answers (2)

aydjay
aydjay

Reputation: 868

I have used the build agent environment parameter, in my case %Python.3%.

I've fed this is in as a configuration parameter to a variable called pythonLocation.

In my build steps I have changed my python runner from python to command line. The command line I run is

%pythonLocation% NameOfTheScrip.py

Upvotes: 1

kt_
kt_

Reputation: 84

Can't you just do the same thing as on Windows? I.e. to place python3 in $PATH.

Update:
One option is to update Linux machine environment, so it will have python pointing to python3. If it is not possible, or you want it to be in effect only for TC, you can overwrite PATH in Teamcity at a project level or at a build configuration level.

In the beginning of PATH put a path that contains python link pointing to python3.

PS. When specifying environment variable in TC don't use constructions like path:$PATH since $PATH will not be expanded.

Upvotes: 0

Related Questions