473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Break Command

13 New Member
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:\Documen ts and Settings\M01091 \Desktop\New Folder\tester.p y", line 72, in ?
TransformerReco rds1 = TransformerData 1.read()
File "C:\Documen ts 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(Res ource):
def read(self):
xfmrSubRecordCo unt = 0
nxfmrSubRecords = 0
xfmrSubRecords = []
key = ""
line = ""
count = 0

for line in self.file.xread lines():
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( xfmrSubRecordCo unt == 0):
#First Transformer Line
line = re.sub("\'.*?\' ",replaceComa,l ine)
recordAttribute s = line.split(",")
I = recordAttribute s[0].strip()
J = recordAttribute s[1].strip()
K = recordAttribute s[2].strip()
CKT = recordAttribute s[3].strip("'")
key = I+J+K+CKT.strip ()
xfmrSubRecords. append(line)
xfmrSubRecordCo unt+=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 2408
Vinnie123
13 New Member
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
14310
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? Basically: "Press any key to continue..." I beleive that I am looking for is something along the lines of a....
15
2727
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 offering. =================================================== #include <stdio.h> #include <stdlib.h>
7
3264
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 I believe if it's solved, the remaining stuff is easy... my full program until now is here: http://www.geocities.com/tom4_h4wk/progmail.zip the...
2
4871
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" src="..\include\gen_validatorv2.js" type="text/javascript"></script> </head>
7
9688
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 for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for...
3
1916
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 as fun as coding it... And yes alarm bells went off when I found myself typing eval(), and I'm sure this is an 'unusual' use of for: else: . And I...
2
1710
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 sent to me: A one Gig Jump drive
3
1985
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.. need help asap... import java.applet.Applet; import java.text.*; import java.awt.*; import java.awt.List; import java.awt.event.*; import...
2
2887
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 help? my script is below. thank you import java.awt.*; //import all java.awt import java.awt.event.*; //import all java.awt.event import...
0
7700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5513
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.