Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve interactive mode detection #183

Merged
merged 2 commits into from Jun 2, 2019
Merged

Improve interactive mode detection #183

merged 2 commits into from Jun 2, 2019

Conversation

theskumar
Copy link
Owner

@theskumar theskumar commented Jun 2, 2019

Previously, this checked whether __file__ was defined in globals(). globals()
is tied to the current module, so this will always be defined. Fix this by
importing __main__ and asking whether it has __file__ defined. This approach is
outlined in https://stackoverflow.com/a/2356420.

Thanks @andrewsmith

Previously, this checked whether __file__ was defined in globals().  globals()
is tied to the current module, so this will always be defined. Fix this by
importing __main__ and asking whether it has __file__ defined. This approach is
outlined in stackoverflow.com/a/2356420.

Thanks @andrewsmith
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 89.757% when pulling ad75a0a on pr-102 into 436b1be on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 89.757% when pulling ad75a0a on pr-102 into 436b1be on master.

@coveralls
Copy link

coveralls commented Jun 2, 2019

Coverage Status

Coverage decreased (-0.5%) to 89.757% when pulling 477a854 on pr-102 into 436b1be on master.

@theskumar theskumar merged commit a1c6eb5 into master Jun 2, 2019
@theskumar theskumar deleted the pr-102 branch June 2, 2019 17:15
johnbergvall pushed a commit to johnbergvall/python-dotenv that referenced this pull request Aug 13, 2021
* Improve interactive mode detection

Previously, this checked whether __file__ was defined in globals().  globals()
is tied to the current module, so this will always be defined. Fix this by
importing __main__ and asking whether it has __file__ defined. This approach is
outlined in stackoverflow.com/a/2356420.

Thanks @andrewsmith
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants