]> gitweb.pimeys.fr Git - scripts-20-100.git/commitdiff
Pour dumper la dernière session ipython
authorVincent Le Gallic <legallic@crans.org>
Sat, 18 Oct 2014 12:32:00 +0000 (14:32 +0200)
committerVincent Le Gallic <legallic@crans.org>
Sat, 18 Oct 2014 12:32:18 +0000 (14:32 +0200)
extract_sess.py [new file with mode: 0755]

diff --git a/extract_sess.py b/extract_sess.py
new file mode 100755 (executable)
index 0000000..c7c2016
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+import sqlite3
+import os
+
+c = sqlite3.connect(os.path.expanduser('~/.ipython/profile_default/history.sqlite'))
+
+r = c.execute('select * from history where session=(select max(session) from sessions);')
+
+for line in iter(r.fetchone, None):
+    print line[-1].encode('utf-8')