Decide whether this is running in a REPL or IPython notebook
()
| 279 | """ |
| 280 | |
| 281 | def _is_interactive(): |
| 282 | """ Decide whether this is running in a REPL or IPython notebook """ |
| 283 | main = __import__('__main__', None, None, fromlist=['__file__']) |
| 284 | return not hasattr(main, '__file__') |
| 285 | |
| 286 | if usecwd or _is_interactive() or getattr(sys, 'frozen', False): |
| 287 | # Should work without __file__, e.g. in REPL or IPython notebook. |