<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:garamond, 'new york', times, serif;font-size:12pt"><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; "></div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; ">Hi,</div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; ">I'm new to python and trying to run a borrowed script. The error I get suggests that I need to give a proper command to run it. The input file is "<span class="Apple-style-span" style="font-size: medium; ">c26_1plus.csv" and the intended output file is "</span><span class="Apple-style-span" style="font-size: medium; ">c26_1plus_backbone.csv".</span><span class="Apple-style-span" style="font-size: medium; "> </span></div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size:
 12pt; "><br></div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; "><span class="Apple-style-span" style="font-size: medium; "></span>Can anyone help?</div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; "><br></div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; ">BR, Shafique</div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; "><br></div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; ">Error log:</div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; "><br></div><div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">C:\Users\Shafique>extract_backbone.py c:\python26\c26_1plus.csv c:\python26\c26_1plus_backbone</font></div><div><font class="Apple-style-span"
 face="garamond, 'new york', times, serif">Traceback (most recent call last):</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">  File "C:\Python26\extract_backbone.py", line 31, in <module></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    alpha   = float(sys.argv[3])</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">IndexError: list index out of range</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">Excerpts from code:</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">#!/usr/bin/env python</font></div><div><font class="Apple-style-span"
 face="garamond, 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">import sys, os</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">import networkx</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">def extract_backbone(G, weights, alpha):</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre">     </span>blablabla...</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">if __name__ == '__main__':</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"> 
   </font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    if "-h" in sys.argv[1:] or "--help" in sys.argv[1:]:</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">        usage = """python %s input_file output_file backbone_alpha [file delimiter]"""</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">        sys.exit(usage)</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    </font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    in_file = sys.argv[1]</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    ot_file = sys.argv[2]</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">   
 alpha   = float(sys.argv[3])</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    try:</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">        delimiter = sys.argv[4]</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">    except:</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">        delimiter = "\t"</font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif">...blablabla...</font></div></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="garamond, 'new york', times, serif"><div># save the new edgelist:</div><div>    f = open(ot_file, 'w')</div><div>    for ni,nj in
 G_backbone.edges():</div><div>        f.write("%s%s%s\n" % (ni,delimiter,nj) )</div><div>    f.close()</div></font></div><div style="color: black; font-family: garamond, 'new york', times, serif; font-size: 12pt; position: fixed; "></div>


<!-- cg4.c902.mail.ac4.yahoo.com compressed/chunked Sun May  1 08:59:27 UTC 2011 -->
<script language="javascript"><!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img",0);//-->
</script></div></body></html>