Commit ad75a0a
Saurabh Kumar
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 @andrewsmith1 parent 436b1be commit ad75a0a
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
| |||
0 commit comments