##// END OF EJS Templates
use pathlib in ipython-get-history.py
rushabh-v -
Show More
@@ -17,13 +17,15 b' to build much more flexible and powerful tools to browse and pull from the'
17 history database.
17 history database.
18 """
18 """
19 import sys
19 import sys
20 from pathlib import Path
20
21
21 from IPython.core.history import HistoryAccessor
22 from IPython.core.history import HistoryAccessor
22
23
23 session_number = int(sys.argv[1])
24 session_number = int(sys.argv[1])
24 if len(sys.argv) > 2:
25 if len(sys.argv) > 2:
25 dest = open(sys.argv[2], "w")
26 filepath = Path(sys.argv[2])
26 raw = not sys.argv[2].endswith('.py')
27 dest = open(filepath, "w")
28 raw = not filepath.name.endswith('.py')
27 else:
29 else:
28 dest = sys.stdout
30 dest = sys.stdout
29 raw = True
31 raw = True
General Comments 0
You need to be logged in to leave comments. Login now