I want to work on an assignment for university, that requires LLVM and makes use of their integrated tester (
llvm-lit is written in Python. I have some version of Python 3 installed, so I try to run it using the
py launcher for Windows. I get no output and no errors.
I try some other commands like
python. When I type
python into the Command Prompt, the Microsoft Store opens showing the page for Python 3.7 which I already have installed (from the Python website).
I open the
llvm-lit.py script (it just sets up some paths and loads another module) and try to debug it using print statements.
That’s when I notice the shebang line (
#!/usr/bin/env python). Deleting this line makes the script work.
Reading the Python documentation, I figure out that the launcher analyzes the shebang line and selects Python 2 based on this specific shebang line.
I don’t have Python 2 installed. It remains a mystery why I don’t get any output indicating this. Anyway, I can override the version using
py -3 path/to/llvm-lit.py (which works fine by the way).
That concludes this little adventure. Morals of the story:
- Dependencies are bad. (But LLVM probably has its reasons to choose Python over C++ here.)
- Probably something about interpreted languages.
- The current state of software is very frustrating.
Now, what was I working on? Oh, yes, I wanted to work on an assignment for university…