<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 4:16 PM, <span dir="ltr"><<a href="mailto:aramildaern@gmail.com" target="_blank">aramildaern@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone! I don't mean to intrude, but ive heard great things about this group and ive stumped myself with my python code.<br>
</blockquote><div><br></div><div>No intrusion. That is what the list is for.<br><br></div><div>Two points:<br><br></div><div>You should use a descriptive subject line -- "Help" isn't really descriptive.<br>
</div><div>You should run your code, cut and paste the traceback you get showing the errors. This is extremely useful for people to help you with, and as you program, you will learn how useful it can be to find problems on your own.<br>
<br></div><div>So, do that, and come back with that info <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
heres my code:<br>
#! /usr/bin/python<br>
<br>
import sys<br>
<br>
global labelList<br>
labelList= dict()<br>
<br>
global counter<br>
counter = 0<br>
<br>
def execute(line):<br>
if line.find("::print") != -1:<br>
stripPrint = line.find("::print")<br>
startPrint = line.find('"', stripPrint)<br>
stopPrint = line.find('"', startPrint + 1)<br>
printSection = line[startPrint + 1 : stopPrint]<br>
print(printSection)<br>
<br>
if line.find("::label") != -1:<br>
stripLabel = line.find("::label")<br>
startLabel = line.find(' ', stripLabel)<br>
stopLabel = line.find('--', startLabel + 1)<br>
label = line[startLabel + 1 : stopLabel]<br>
line.strip("\r\n")<br>
labelList[label] = counter<br>
<br>
if len(sys.argv) < 2:<br>
print("error: no input files")<br>
print("compilation terminated")<br>
<br>
else:<br>
fileName = sys.argv[1]<br>
jadeFile = open(fileName, 'r')<br>
<br>
for line in jadeFile:<br>
counter = counter + 1<br>
execute(line)<br>
<br>
jadeFile.close()<br>
<br>
i = 0<br>
<br>
while i < len(labelList):<br>
print(labelList.keys()[i], ":", labelList.values()[i])<br>
i = i + 1<br>
<br>
<br>
and its giving me a bunch of errors thanks for the help in advance!<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>