andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 38 forks source link

Error when opening too big file #202

Closed vi closed 10 years ago

vi commented 10 years ago
Traceback (most recent call last):
  File "/mnt/src/git/enki/bin/../enki/core/locator.py", line 571, in _onEnterPressed
    command.execute()
  File "/mnt/src/git/enki/bin/../enki/plugins/workspace_commands.py", line 204, in execute
    core.workspace().goTo(path)
  File "/mnt/src/git/enki/bin/../enki/core/workspace.py", line 418, in goTo
    document = self.openFile(filePath)  # search for already opened or open new
  File "/mnt/src/git/enki/bin/../enki/core/workspace.py", line 530, in openFile
    document = self._openSingleFile(filePath)
  File "/mnt/src/git/enki/bin/../enki/core/workspace.py", line 505, in _openSingleFile
    document = Document(self, filePath)
  File "/mnt/src/git/enki/bin/../enki/core/document.py", line 199, in __init__
    originalText = self._readFile(filePath)
  File "/mnt/src/git/enki/bin/../enki/core/document.py", line 253, in _readFile
    text = unicode(data, 'utf8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
MemoryError

when trying to open /home/vi/s2/iso/linuxmint-11-gnome-dvd-32bit.iso.

I think enki should detect attempts to open too big things and either behave well in this case or ask user for a confirmation.