commit 96ac59bcb521b52df5fe66a2438808db8f2de29d
# get a controller
In [11]: lc = leoBridge.controller()
# open a file
In [11]: leof = lc.openLeoFile('pged.leo')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-a1be1ac7f628> in <module>()
----> 1 leof = lc.openLeoFile('pged.leo')
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoBridge.py in openLeoFile(self, fileName)
312 if self.isOpen():
313 fileName = self.completeFileName(fileName)
--> 314 c = self.createFrame(fileName)
315 g.app.nodeIndices.compute_last_index(c)
316 # New in Leo 5.1. An alternate fix for bug #130.
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoBridge.py in createFrame(self, fileName)
346 import time; t1 = time.time()
347 # This takes a long time due to imports in c.__init__
--> 348 c = g.openWithFileName(fileName)
349 if trace:
350 t2 = time.time()
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoGlobals.py in openWithFileName(fileName, old_c, gui)
3244 returns the commander of the newly-opened outline.
3245 """
-> 3246 return g.app.loadManager.loadLocalFile(fileName, gui, old_c)
3247 #@+node:ekr.20150306035851.7: *3* g.readFileIntoEncodedString
3248 def readFileIntoEncodedString(fn, silent=False):
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoApp.py in loadLocalFile(self, fn, gui, old_c)
2874 # Step 2: open the outline in the requested gui.
2875 # For .leo files (and zipped .leo file) this opens the file a second time.
-> 2876 c = lm.openFileByName(fn, gui, old_c, previousSettings)
2877 return c
2878 #@+node:ekr.20120223062418.10394: *5* LM.openFileByName & helpers
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoApp.py in openFileByName(self, fn, gui, old_c, previousSettings)
2911 readAtFileNodesFlag = bool(previousSettings)
2912 # The log is not set properly here.
-> 2913 ok = lm.readOpenedLeoFile(c, fn, readAtFileNodesFlag, theFile)
2914 # Call c.fileCommands.openLeoFile to read the .leo file.
2915 if not ok: return None
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoApp.py in readOpenedLeoFile(self, c, fn, readAtFileNodesFlag, theFile)
3081 # lm = self
3082 ok = c.fileCommands.openLeoFile(theFile, fn,
-> 3083 readAtFileNodesFlag=readAtFileNodesFlag)
3084 # closes file.
3085 if ok:
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoFileCommands.py in openLeoFile(self, theFile, fileName, readAtFileNodesFlag, silent)
831 theFile, fileName,
832 readAtFileNodesFlag=readAtFileNodesFlag,
--> 833 silent=silent,
834 )
835 if ok:
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoFileCommands.py in getLeoFile(self, theFile, fileName, readAtFileNodesFlag, silent, checkOpenFiles)
665 # This is important for big files like LeoPy.leo.
666 c.redraw()
--> 667 recoveryNode = fc.readExternalFiles(fileName)
668 finally:
669 if g.app.debug: g.trace('=====',
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoFileCommands.py in readExternalFiles(self, fileName)
797 # the @thin nodes!
798 fc.restoreDescendentAttributes()
--> 799 fc.setPositionsFromVnodes()
800 return recoveryNode
801 #@+node:ekr.20031218072017.1554: *6* fc.warnOnReadOnlyFiles
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoFileCommands.py in setPositionsFromVnodes(self)
1347 use_db = g.enableDB and c.mFileName
1348 if use_db:
-> 1349 str_pos = c.cacher.getCachedStringPosition()
1350 if trace: g.trace('cached str_pos', str_pos)
1351 if not str_pos:
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoCache.py in getCachedStringPosition(self)
254 if not c:
255 return g.internalError('no commander')
--> 256 key = self.fileKey(c.mFileName, self.globals_tag)
257 str_pos = self.db.get('current_position_%s' % key)
258 if trace: g.trace(c.shortFileName(), str_pos)
/opt/venv/newtdb/lib/python3.5/site-packages/leo/core/leoCache.py in fileKey(self, fileName, content, requireEncodedString)
132 if branch and g.isUnicode(branch):
133 branch = g.toEncodedString(branch)
--> 134 m.update(branch)
135 m.update(fileName)
136 m.update(content)
TypeError: Unicode-objects must be encoded before hashing