0

I'm trying to run a "py" file from ubuntu terminal (by calling a script file with ./run_dlc_filter_predictions.py)

This line within the code is throwing a syntax error near unexpected token '(' - that I'm receiving in the terminal.

import pathlib
project_path = pathlib.Path(__file__).parent

Any idea how to fix it? The syntax seems perfectly fine to me. I spent hours trying to figure it out, and no idea. What could I possibly be missing?

2
  • 3
    You need to add #!/usr/bin/env python3 as the first line or you need to call with python3 ./run_dlc_filter_predictions.py. By default linux will try to execute a script using /bin/sh if you do not specify a shebang. Commented Aug 24, 2022 at 15:27
  • Oh my god, I knew it's gonna be something like that. THANK YOU SO MUCH. Commented Aug 24, 2022 at 15:28

1 Answer 1

1

If already installed, ya can call “python3” the script name, so it’ll run too.

python3 run_dlc_filter_predictions.py
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.