2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

vscodeが勝手に.envを読み込むの何とかしてほしい

Posted at

workspaceに.envファイルが置いていあるpythonのプロジェクトをvscode開き、ctrl + shift + @でterminalを立ち上げると勝手に.envを読み込みます。しかも:をエスケープして。

なので、.envに

DB_PATH=sqlite:///sqlite.db

とかって書いてると、勝手にDB_PATHにsqlite\xa///sqlite.dbが設定され、terminalでコマンド実行に影響を及ぼします。

対策: settings.jsonでpythonのextensionの設定を変える

設定画面からPython: Env Fileの項目を編集するか、settings.jsonを編集するかでpython.envFileを空にします。

pic.png

pic2.png

デフォルトでこういう設定になってるっていうことは何らかの理由があってのことだと思いますが、ターミナル起動時に.envが自動で読み込まれないと困るっていう状況が想像つかないです。
せめて、勝手にエスケープしないでほしい。

2
0
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?