Cylc-flow: cylc-cat-log doesn't respect shebang python

Created on 30 Apr 2020  路  3Comments  路  Source: cylc/cylc-flow

Describe the bug

Was running some tests for #3585 with a Docker image that has Ubuntu 18.04, that comes with system Python 3.6, and no Anaconda.

I installed the Ubuntu packages for Python 3.7. So python is the Ubuntu default python2, python3.6 is Py3.6, and there is also python3.7. I used update-alternatives (common utility in Ubuntu to set Java/Python/bash/other utilities path and create symlinks) to define python3 as python3.7 instead of Py3.6.

Everything was working fine with Cylc, but when I tried cylc cat-log as in the example command from @hjoliver it failed complaining about not being able to locate python. That got me worried for a second.

But looking at the code, it appears to ignore the shebang value of Python and instead execute python as follows:

https://github.com/cylc/cylc-flow/blob/3ffb24b9a561f99b7fb11a152116db7b130d39d3/cylc/flow/scripts/cylc_cat_log.py#L134-L147

By changing from python to python3 it worked locally. But I have not confirmed if this is the only place with this problem, nor am sure if that's the correct fix. Probably @hjoliver or @oliver-sanders can take a look and tell if there was a reason for using python, or if the fix is really just appending 3.

Release version(s) and/or repository branch(es) affected?

master
Steps to reproduce the bug

Expected behavior

See logs with no errors.

Screenshots

Additional context

Pull requests welcome!
This is an Open Source project - please consider contributing a bug fix
yourself (please read CONTRIBUTING.md before starting any work though).

bug

All 3 comments

cylc cat-log is mostly my fault, but that bit of it is from @oliver-sanders so I'll let him respond :grin:

Oops.

I think changing it to python3 is the correct fix, it's effectively the same as /usr/bin/env python3 and is what we've done elsewhere.

Thanks @oliver-sanders ! I can prepare a PR for that tomorrow and look if that happens elsewhere, or happy if anyone beats me to it and prepares the fix before :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kinow picture kinow  路  3Comments

hjoliver picture hjoliver  路  5Comments

sadielbartholomew picture sadielbartholomew  路  4Comments

kinow picture kinow  路  4Comments

kinow picture kinow  路  3Comments