We run a site called inteokej.nu and I need to find out which version of Python it runs on. I have pulled all the files to my computer but I don't know if and how I can find out the version number from them? The site is hosted on Heroku and maybe there's a way to find out the version with some kind of Heroku command?
As for now I don't have any possibilities to change any code (e.g. add a code snippet to get the version).
Thanks in advance!
Depending on what you need. Either (a) the version you are running on or (b) the version under the .pyc file was compiled?
a. If you need to know the python version you are running, do the following:
b. If you want to know the python version under a .pyc file was compiled, do the following:
The known values are listed in the python source file
Python/import.c
. Here the known values from Python 2.7.10rc1:To solve your problem, you could recursively walk your directory and extract the values from every .pyc file and populate a dictionary with a list of files for every value/version. See following example:
If you are under Linux, you could solve your problem with the following one line commando (thanks to Neftas suggestion!):
This outputs a list with value and filename like the following:
Seems like the least complex answer (for Heroku) is missing:
Log into Heroku bash session, something like this in your authenticated terminal:
then type:
done
If you didn't have access to source code, from headers I can see that server is using Gunicorn 0.17.2, which is compatible with Python 2.x >= 2.6, which rules out i.e. Python 3.
You want to know what runtime is used to run your code on Heroku. At the time of writing this, new applications default to the
Python 2.7.9
runtime. This may have been modified in the 'runtime.txt' file so to find out if it has been set: