473,396 Members | 1,921 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
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 "count = " + str(count)
count = count + 1
elif( line.strip() == ""):
#Skip Blank Line
#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()

if( int(K) == 0):
#No Third Winding, hence Two Winding Transformer Record
nxfmrSubRecords = 4
#Three Winding Transformer Record
nxfmrSubRecords = 5
del line[/PHP]
Aug 13 '07 #1
1 2403
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

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? ...
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...
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...
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"...
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...
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...
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...
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.....
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...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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...
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...
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...
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...
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.