469,271 Members | 1,009 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

"End Of Line" Confusion

ncf
I'm having an odd problem. I'm getting an error from IDLE saying "End
Of Line detected while scanning single-quoted string." Odd thing is,
it's not single-quoted, it's one of the doc-strings (if that's what you
call them).

In the following code (class name replaced with <<<NAME>>>), the error
is being highlighted as the hyphen joining "non" and "ASCII".

class <<<NAME>>>:
<<<CUT>>>
def digest():
''' char[28] digest ( )

Return the digest of the strings passed to the update() method
so far.
This is a 28-byte string which may contain non-ASCII
characters,
including null bytes.
'''
raise NotImplementedError, 'digest() is not yet implemented.'
Thanks in advance. -Wes

Jul 19 '05 #1
3 1783
Well, copying and pasting this text, and changing <<<NAME>>> to Foo so
that its a legal Python identifier (why did you not want to name your
class, out of curiosity), I get no problems with this.

class Foo:
def digest():
''' char[28] digest ( )

Return the digest of the strings passed to the update() method
so far.
This is a 28-byte string which may contain non-ASCII
characters,
including null bytes.
'''
raise NotImplementedError, 'digest() is not yet implemented.'
foo = Foo()
foo

<__main__.Foo instance at 0x00B30C38>

So all I can suggest is that you have accidentally mixed double and
single quotes, or there is a quote mark somewhere in the docstring in
your copy of the code, or some strange, platform/system/text editor/etc
specific bug is causing this, or i don't know what else.

Oh and btw, I suspect, form the lack of @staticmethod on the line above
def digest():, that you perhaps meant def digest(self): ?

Jul 19 '05 #2
ncf
First off, my apologies...Google Groups doesn't seem to want to let me
reply inline.

I refrained from putting the name in there as it's potentially
offensive (gotta love America). If you would aid you, I can send you
the entire Python script via. email. Editor was IDLE on Slackware Linux
using the ReiserFS Filesystem (not like the FS matters :P).

There is not a quote mark in the docstring. What I posted for the
function def is a straight-forward copy and paste.

I'll try doing a hex-dump on the file and see if there's any odd bytes
in there that shouldn't be. Yea, I think I did mean that. :P I hadn't
yet even *begun* to work on the other areas...just working on the
bit-wise math and what-not.

-Wes

Jul 19 '05 #3
If you email the script to me, I'd be happy to take a look at it and
see if I come up with the same error (I'm running IDLE on a Windows XP
box here, cant remember if the filesystem is FAT or NTFS ;-))

Although as a relative newbie I've never come across it myself, one
possible source of such mysterious errors in Python, apparently, is
mixing tabs and spaces in your indentation. Its also one of the few
factors I can think of that would have been lost in the
email-copy-paste process, which could explain why the code snippet
works on my machine and not yours.

My only other suggestion is to try my personal first rule for fixing
mysterious, unusual bugs in small, trivial pieces of code - which is to
delete the whole thing and type it out again from scratch. It works
surprisingly often.

Good luck
- Jordan

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Simon Wigzell | last post: by
3 posts views Thread by Colleyville Alan | last post: by
3 posts views Thread by Summit | last post: by
3 posts views Thread by caston | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.