Uwe Schuerkamp writes:
I've run into a problem using an External Method with reads an mp3 info tag from a *file* and expects a file name argument as such. Then, the function happily calls os.stat on the argument and so on, which all break because the mp3 file is actually an object in a zope folder and not something living in the file system.
Is there an easy way to modify the function to operate on a zope file object? Probably, but I did not look at the code.
I expect, the function uses "os.stat", maybe some other "os" functions, opens the file and looks at its header. You should skip everything until ofter the file is open and read. Zope file objects have an attribute "data". This is a string, when the file is sufficiently small, otherwise, it is a more complex object (that stores the file contents in chunks). You can use "str" on this attribute to always convert it into a string (containing the files content). However, you will then be less efficient. The best approach would be to just use the first chunk in this case. Please look at the objects method to learn how to do this. Once, you have the first chunk of the file object, you proceed as the original method did after it have opened and read the file. Dieter