473,396 Members | 1,786 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.

Help with Break Command

What in the world is going on here? I cannot get my "break" statement to work.

When I run this class, I get the following output:

>>>
---BREAK--- 0
WHY WON'T YOU BREAK
count = 0
Traceback (most recent call last):
File "C:\Documents and Settings\M01091\Desktop\New Folder\tester.py", line 72, in ?
TransformerRecords1 = TransformerData1.read()
File "C:\Documents and Settings\M01091\Desktop\New Folder\psseraw.py", line 338, in read
if( int(K) == 0):
ValueError: invalid literal for int(): 250.000
>>>

The error is correct, but it should never get to this point, because I call the break command. But for whatever reason, it does not seem to want to break out of the for loop. Any ideas?? The class is below:

[PHP]class Transformer(Resource):
def read(self):
xfmrSubRecordCount = 0
nxfmrSubRecords = 0
xfmrSubRecords = []
key = ""
line = ""
count = 0

for line in self.file.xreadlines():
line = line.split("/") #Remove Comments
line = line[0]

if( line.strip() == "0"):
#End of Transformer Section
print "---BREAK---", line.strip()
print "WHY WON'T YOU BREAK"
print "count = " + str(count)
count = count + 1
break # WHY ISN'T IT BREAKING HERE???
elif( line.strip() == ""):
#Skip Blank Line
pass
else:
#Process Transformer Entry
if( xfmrSubRecordCount == 0):
#First Transformer Line
line = re.sub("\'.*?\'",replaceComa,line)
recordAttributes = line.split(",")
I = recordAttributes[0].strip()
J = recordAttributes[1].strip()
K = recordAttributes[2].strip()
CKT = recordAttributes[3].strip("'")
key = I+J+K+CKT.strip()
xfmrSubRecords.append(line)
xfmrSubRecordCount+=1

if( int(K) == 0):
#No Third Winding, hence Two Winding Transformer Record
nxfmrSubRecords = 4
else:
#Three Winding Transformer Record
nxfmrSubRecords = 5
del line[/PHP]
Aug 13 '07 #1
1 2402
Nevermind, figured it out, was not a programming error, was just an error in the handling of my class. Thanks tho!
Aug 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
15
by: Buck Rogers | last post by:
Hi guys! Task 1: Write a program which presents a menu with 5 options. The 5th option quits the program. Each option should execute a system command using system(). Below is my humble...
7
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
2
by: this one | last post by:
I have the following code <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
3
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
2
by: jhhbr549 | last post by:
I need my result to print out only in the box created with a scroll bar. It has to look like this. The Twelve Days of It by John H. Howard On the First day of It My true LOVE of Computers...
3
by: splintercell | last post by:
well i got this code from java.sun.com and tried modiifying it in all the possible ways,but to no good.. stil its not workin..pleas help me out and try postin good workinw web cralwer if u have.....
2
by: rookiejavadude | last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...

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.