<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Chris <div><br></div><div>Thank you for the info.  I figure it out. But thank you again.</div><div><br></div><div>Ed <br><div><blockquote type="cite"><div>On Jul 28, 2014, at 5:42 PM, Chris Kaynor <<a href="mailto:ckaynor@zindagigames.com">ckaynor@zindagigames.com</a>> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 28, 2014 at 2:33 PM, Edward Manning<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:ejmmanning@gmail.com" target="_blank">ejmmanning@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">I wrote this code, but it seem to work fine if I only have one ip in the file. When I have more than one IP in the file </div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">I get a error. Does anyone have an idea why.    </div></div></blockquote><div class="gmail_quote"><br></div>It would be helpful to know what the error you are getting is. It is also a good idea to generally provide the Python version and OS version with your messages, as they can often make a major difference. As it is, I've made my best guess below (in bold), I've also included some other notes that may cause issues, but I doubt are causing your error.<br><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">import socket<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">def main():<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span># get file names<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span>infileName = input ("What file our the IP adderss in?  ")<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span>outfileName = input("What file should the results go in?")<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span># open files<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span>infile = open(infileName, "r")<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span>outfile = open(outfileName, "w")</div></div></blockquote><div><br></div><div>While this shouldn't cause the issue your reporting (without other issues going on), Its generally a better idea to use the with statement to open file, like so:</div><div>with open(infileName, "r") as infile:</div><div>    # code that needs infile goes here.</div><div><br></div><div>This will ensure that the file is closed when you are done with it, even if an error occurs in the code that may prevent the code from running to completion.</div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span>#Proccess each line of the input file<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u> <u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">   <span class="Apple-converted-space"> </span>for line in infile:<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">       <span class="Apple-converted-space"> </span>ipAddress = line.strip()</div></div></blockquote><div><br></div><div>I'm guessing that, when you only have one IP, you do not have a trailing new-line in the file, but when you put more than one in the file, you have a trailing new-line. You can try adding:</div><div><br></div><div>if not ipAddress:</div><div>    continue</div><div><br></div><div>here to ignore any empty lines (due to the line.strip() above, it will also ignore all white-space lines) you might get. This may be the cause of your error...</div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">       <span class="Apple-converted-space"> </span>resluts = socket.gethostbyaddr(ipAddress)<u></u><u></u></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">       <span class="Apple-converted-space"> </span>print(resluts[0],resluts[2], end="")</div></div></blockquote><div><br></div><div>Note that this does not seem to be printing into outfile (its printing to stdout instead). I presume this is for debugging purposes.</div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">--<br><a href="https://mail.python.org/mailman/listinfo/python-list" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a></blockquote></div></div></div></div></blockquote></div><br></div></body></html>