Flimm
Flimm

Reputation: 150813

How can I detect if Python is running in Python Development Mode?

To turn on Python Development Mode, you can use this flag:

python3 -X dev example.py

or use this environment variable:

PYTHONDEVMODE=1 python3 example.py

How can I write code within example.py to detect whether Python is running in Python Development Mode or not?

Upvotes: 3

Views: 1886

Answers (1)

Sameera K
Sameera K

Reputation: 1438

sys.flags.dev_mode is True, when running as python -X dev app.py

Upvotes: 2

Related Questions