27 Aug 2011 23:05
some little problems
Hi
i tries to use the hachoir-editor library and i got some problems.
first
there is no setup.py script in the directory ( it's not important but more easier to use )
second
in this example
from hachoir_core.field import writeIntoFile
editor = createEditor(u"file.gz")
del editor["filename"]
editor["has_filename"].value = False
writeIntoFile(editor, u"noname.gz")
I got this error
Traceback (most recent call last):
File "first.py", line 6, in <module>
editor["has_filename"].value = False
File "/usr/local/lib/python2.6/dist-packages/hachoir_editor/fieldset.py", line 244, in __getitem__
raise MissingField(self, key)
hachoir_core.field.field.MissingField
in this example
from hachoir_editor import createEditor
from hachoir_core.field import writeIntoFile
from hachoir_editor import EditableInteger, EditableBytes
//// i modified this line
editor = createEditor(u"file.gz")
extra = "abcd"
editor["has_extra"].value = True
editor.insertAfter("os", EditableInteger(editor, "extra_length", False, 16, len(extra)), EditableBytes(editor, "extra", extra))
writeIntoFile(editor, u"file_extra.gz")
I got this error
Traceback (most recent call last):
File "second.py", line 7, in <module>
editor["has_extra"].value = True
File "/usr/local/lib/python2.6/dist-packages/hachoir_editor/fieldset.py", line 244, in __getitem__
raise MissingField(self, key)
Thanks for your help
Luc Xation
RSS Feed