[Zope] Weird error in python module
Jens Vagelpohl
jens@digicool.com
Thu, 19 Jul 2001 07:45:24 -0400
your indentation looks screwy. i can already see from the code below that
the body of your method is indented 3 spaces from the method signature.
i would assume the method signature (the line starting with "def") is
indented one space too far. make sure you look at the indentation in code
*above* your method as well.
jens
On Thursday, July 19, 2001, at 07:17 , Gitte Wange wrote:
> Hello out there :-)
>
> I have written a python module used to upload files.
> But when I try to start Zope, I get an error. And I can't figure out what
> is
> wrong. The error is:
> 2001-07-19T11:25:36 ERROR(200) Zope Couldn't import Products.MMMCore
> Traceback (innermost last):
> File /usr/local/Zope-2.3.2-linux2-x86/lib/python/OFS/Application.py,
> line
> 528, in import_products
> (Object: string)
> File
> /usr/local/Zope-2.3.2-linux2-x86/lib/python/Products/MMMCore/__init__.py,
> line 91, in ?
> File
> "/usr/local/Zope-2.3.2-linux2-x86/lib/python/Products/MMMCore/MasterFile.
> py",
> line 280
> def _copy_data(self, instream, outstream):
> ^
> SyntaxError: invalid token
>
> And the code looks like this:
>
> def _copy_data(self, instream, outstream):
> """Copy data"""
> if type(instream) is StringType:
> outstream.write(instream)
> else:
> try:
> instream.seek(0,2)
> size=instream.tell()
> instream.seek(0)
> blocksize=2<<16
> pos=0
> while pos<size:
> outstream.write(instream.read(blcksize))
> pos=pos+blocksize
> instream.seek(0)
> except:
> outstream.write(instream.read())
>
> Does anybody know what might be wrong ??
>
> Regards,
> --
> Gitte Wange Jensen
>