From fd49737a00655983480a00d282430f9acb90d784 2020-10-21 06:27:55
From: rushabh-v <vasanirushabh24@gmail.com>
Date: 2020-10-21 06:27:55
Subject: [PATCH] use pathlib in ipython-get-history.py

---

diff --git a/examples/IPython Kernel/ipython-get-history.py b/examples/IPython Kernel/ipython-get-history.py
index 5e68bf5..b99fa3a 100755
--- a/examples/IPython Kernel/ipython-get-history.py
+++ b/examples/IPython Kernel/ipython-get-history.py
@@ -17,13 +17,15 @@ to build much more flexible and powerful tools to browse and pull from the
 history database.
 """
 import sys
+from pathlib import Path
 
 from IPython.core.history import HistoryAccessor
 
 session_number = int(sys.argv[1])
 if len(sys.argv) > 2:
-    dest = open(sys.argv[2], "w")
-    raw = not sys.argv[2].endswith('.py')
+    filepath = Path(sys.argv[2])
+    dest = open(filepath, "w")
+    raw = not filepath.name.endswith('.py')
 else:
     dest = sys.stdout
     raw = True