UCL-COMP0233-24-25 / RSE-Classwork

6 stars 86 forks source link

Automating `git bisect` - part IV #25

Open dpshelio opened 1 week ago

dpshelio commented 1 week ago

Continuation from #24.

Now that you have created two arrays, can read and save them, and compare expected values.

Step 4

[!CAUTION] If you are using Windows, it will be easier to run the following from Git Bash (otherwise read the following information)

Are you using Windows and getting errors? If you're on Windows, ideally use Git Bash (If you're on the Windows Command Prompt `cmd`, you need to pass `cmd`-compatible commands to subprocess, e.g. `dir` instead of `ls`). On Windows, you might also need to pass `shell=True` as an additional argument. ```python subprocess.run(["ls", "-lh"], shell=True) ```

Use subprocess to call a system command from within python. The aim is for later to call Charlene's programme.

On a different python file (e.g., test_call_command.py) start with this content:

import subprocess

subprocess.run(["ls", "-aF"])

and run it!

Once it produces the expected output, iterate a couple of times changing the command that runs with others like:

Once you've understood how subprocess.run works, try to call Charlene's programme.

Hint How do you call a Python script from the command line? `______ filename.py`.

React to this issue (#25) with a ❤ when your team has completed this task.