J.Zil
J.Zil

Reputation: 2449

Running a python file in a directory

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.

Upvotes: 0

Views: 41

Answers (1)

Michał Tabor
Michał Tabor

Reputation: 2467

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

Upvotes: 1

Related Questions