Configure Path to Python Executable

I am experimenting with building Brave. I have done this successfully and launched it from the command line, both directly and with npm start at the top of the source tree. The build had been failing due to a python script requiring python2 (the failing script uses the old form print statement). I was able to trace through the .gn files to the origin of this, it was a template whose .action included the python script. It seems though that the gn system determines which executable to use from elsewhere, perhaps from the ‘.py’ extension of the script, and on every invocation it generates the “command = python …” lines in the file. I was not able to find a way to change the name of the python executable in the build system, and so I “fixed” the problem by changing the existing symlink (to python3) to point to python2 for purposes the build.

I am glad to know the build was successful, but this is obviously not a good solution to the problem. Can someone help me with how to configure the build so I get “command = python2 …”?

For what it’s worth, I have determined another method is to use pyenv. This is arguably better than changing the system level symlink, but it is debatable which way is more of a hack. I still maintain hope there might be a way to configure the build system to specify the correct path to python2. Any advice is appreciated.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.