0

This may be a basic question but is there any difference in these two:

First:

cd /dir/
python run.py

Second:

python /dir/run.py

It seems previously executing them in these different ways seemed to cause different results, but it may be down to another factor.

0

1 Answer 1

1

The __file__ variable is set differently so it will have impact on calling resources inside your script (different relative paths).

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

1 Comment

Also, current working directory as returned by os.getcwd() gets changed.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.