Show More
@@ -762,8 +762,10 b" def magic_history(self, parameter_s = ''):" | |||||
762 | the default is the last 10 lines. |
|
762 | the default is the last 10 lines. | |
763 |
|
763 | |||
764 | -f FILENAME: instead of printing the output to the screen, redirect it to |
|
764 | -f FILENAME: instead of printing the output to the screen, redirect it to | |
765 |
the given file. The file is always overwritten, though |
|
765 | the given file. The file is always overwritten, though *when it can*, | |
766 | confirmation first if it already exists. |
|
766 | IPython asks for confirmation first. In particular, running the command | |
|
767 | "history -f FILENAME" from the IPython Notebook interface will replace | |||
|
768 | FILENAME even if it already exists *without* confirmation. | |||
767 |
|
769 | |||
768 | Examples |
|
770 | Examples | |
769 | -------- |
|
771 | -------- | |
@@ -801,12 +803,11 b" def magic_history(self, parameter_s = ''):" | |||||
801 | try: |
|
803 | try: | |
802 | ans = io.ask_yes_no("File %r exists. Overwrite?" % outfname) |
|
804 | ans = io.ask_yes_no("File %r exists. Overwrite?" % outfname) | |
803 | except StdinNotImplementedError: |
|
805 | except StdinNotImplementedError: | |
804 | print("Overwriting file.") |
|
|||
805 | ans = True |
|
806 | ans = True | |
806 | if not ans: |
|
807 | if not ans: | |
807 | print('Aborting.') |
|
808 | print('Aborting.') | |
808 | return |
|
809 | return | |
809 |
|
810 | print("Overwriting file.") | ||
810 | outfile = open(outfname,'w') |
|
811 | outfile = open(outfname,'w') | |
811 | close_at_end = True |
|
812 | close_at_end = True | |
812 |
|
813 |
@@ -984,6 +984,12 b' Currently the magic system has the following functions:\\n"""' | |||||
984 |
|
984 | |||
985 | In [1]: 'a' in _ip.user_ns |
|
985 | In [1]: 'a' in _ip.user_ns | |
986 | Out[1]: False |
|
986 | Out[1]: False | |
|
987 | ||||
|
988 | Notes | |||
|
989 | ----- | |||
|
990 | Calling this magic from clients that do not implement standard input, | |||
|
991 | such as the ipython notebook interface, will reset the namespace | |||
|
992 | without confirmation. | |||
987 | """ |
|
993 | """ | |
988 | opts, args = self.parse_options(parameter_s,'sf') |
|
994 | opts, args = self.parse_options(parameter_s,'sf') | |
989 | if 'f' in opts: |
|
995 | if 'f' in opts: | |
@@ -1056,6 +1062,12 b' Currently the magic system has the following functions:\\n"""' | |||||
1056 |
|
1062 | |||
1057 | In [11]: who_ls |
|
1063 | In [11]: who_ls | |
1058 | Out[11]: ['a'] |
|
1064 | Out[11]: ['a'] | |
|
1065 | ||||
|
1066 | Notes | |||
|
1067 | ----- | |||
|
1068 | Calling this magic from clients that do not implement standard input, | |||
|
1069 | such as the ipython notebook interface, will reset the namespace | |||
|
1070 | without confirmation. | |||
1059 | """ |
|
1071 | """ | |
1060 |
|
1072 | |||
1061 | opts, regex = self.parse_options(parameter_s,'f') |
|
1073 | opts, regex = self.parse_options(parameter_s,'f') |
General Comments 0
You need to be logged in to leave comments.
Login now