1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

スクリプトのディレクトリは暗黙的にsys.pathに追加される(スクリプトとしての実行でなくpython -mとしての実行だと追加されない)

Posted at
$ cat test_0.py 
import sys
print(sys.path)
pytest -s test_0.py

['/usr/local/bin', (snip)]
python -m pytest -s test_0.py

['', (snip)]

/usr/local/bin 内の.pyを(ここではtest_0.py内で)暗黙的にimportすることは、python -mだとできませんので注意。

私がこれで2時間ほどはまったので。。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?