473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"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 1950
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andr? Roberge | last post by:
I want to "import and execute" a python program (input_test.py below) within another program (execute_test.py below) and "watch it" being executed. By watching it, I mean to display the file...
13
by: Simon Wigzell | last post by:
Can I trap when the scroll is ended? This is what I want - the calculator disapears when the site visitor starts scrolling the main page. I'm doing that with an "onScroll()" function. I'm bringing...
3
by: Colleyville Alan | last post by:
I am constructing a SQL command from a function. Some code builds the WHERE clause in a looping structure and passes that as an argument to the SQL-building function. But the results do not...
3
by: Summit | last post by:
Does anyone know what the C# equivalent for VB6 End is? I'm starting up a form with a boolean test. If I fail, I just want to end the app. Even though I close the form, it picks up on the line...
4
by: Tran Hong Quang | last post by:
Hi, I'm using Windows 2000, English version, Microsoft Visual Studio.Net 2003. I compile a project developed for Japanese client, on which there are some Japanese messages. I have error "End of...
3
by: caston | last post by:
Well, everybody can now agree with the fact that the Ajax hype is over. Still multiple Ajax Frameworks are flourishing, aren't they? So, last night I questioned myself with the following: "When...
5
by: BA | last post by:
Hi there I am trying to write an "application" in Access 2000, that displays a front end and allows the user to interact with the database without seeing Access loaded, in the background, nor on...
5
by: Nathan Sokalski | last post by:
I have an ASP.NET application which is giving the following JavaScript error: 'theForm' is undefined However, when I do a View Source one of the <scriptelements is as follows: <script...
5
by: cfli1688 | last post by:
I have the following xsl: =============================== <xsl:for-each select="ROWSET/ROW"> <xsl:choose> <!-- previous node is blank, this is the first node --> <xsl:when...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.