##// END OF EJS Templates
Warn if user executes !pip or !conda...
Ashwin Vishnu -
Show More
@@ -2521,6 +2521,18 class InteractiveShell(SingletonConfigurable):
2521 Command to execute.
2521 Command to execute.
2522 """
2522 """
2523 cmd = self.var_expand(cmd, depth=1)
2523 cmd = self.var_expand(cmd, depth=1)
2524
2525 # warn if there is an IPython magic alternative.
2526 main_cmd = cmd.split()[0]
2527 has_magic_alternatives = ("pip", "conda")
2528 if main_cmd in has_magic_alternatives:
2529 warnings.warn(
2530 (
2531 "You executed the system command !{0} which may not work "
2532 "as expected. Try the IPython magic %{0} instead."
2533 ).format(main_cmd)
2534 )
2535
2524 # protect os.system from UNC paths on Windows, which it can't handle:
2536 # protect os.system from UNC paths on Windows, which it can't handle:
2525 if sys.platform == 'win32':
2537 if sys.platform == 'win32':
2526 from IPython.utils._process_win32 import AvoidUNCPath
2538 from IPython.utils._process_win32 import AvoidUNCPath
General Comments 0
You need to be logged in to leave comments. Login now