Re: Need help running external program
Thanks to all for your help it is now working, I rant he code through a debugger and found that the input file I was using to create my list of addresses to wget had newlines in them and were therefore breaking my command line. All your advice has been appreciated. RiGGa -- http://mail.python.org/mailman/listinfo/python-list
Re: Need help running external program
Brian van den Broek wrote: Rigga said unto the world upon 2005-02-27 15:04: Tim Jarman wrote: SNIP No, the r was the point - it's there to tell Python not to do any escaping on the string. Try it again with the r and see what happens. Brilliant!!! that works a treat thankyou!!, where on earth did you find out about the 'r' any pointers to documentation appreciated. Thanks RiGGa http://www.python.org/doc/current/ref/strings.html http://www.python.org/doc/current/lib/module-re.html Best, Brian vdB Thanks for all your help with this it is appreciated, one further question though, how do I pass a variable to the external program while using the r Thanks RiGGa -- http://mail.python.org/mailman/listinfo/python-list
Re: Need help running external program
Pink wrote: Rigga wrote: Hi, I am running the line of code below from a shell script and it works fine, however I am at a total loss on how i can run it from within a Python script as every option I have tried fails and it appears to be down to the escaping of certain characters. wget -q www.anywebpage.com -O - | tr '\r' '\n' | tr \' \ | sed -n 's/.*url=\([^]*\).*/\1/p' If your problem is getting a python string without worrying about how to escape the escape sequences, try: rwget -q www.anywebpage.com -O - | tr '\r' '\n' | tr \' \ | sed -n 's/.*url=\([^]*\).*/\1/p' You should be able to pass this directly to a popen() function. Hi, Thanks for replying however I have just tried that and it does not seem to work, it doesnt return any results (i take it the r was a typo) Thanks RiGGa -- http://mail.python.org/mailman/listinfo/python-list
Re: Need help running external program
Tim Jarman wrote: Rigga wrote: Pink wrote: Rigga wrote: Hi, I am running the line of code below from a shell script and it works fine, however I am at a total loss on how i can run it from within a Python script as every option I have tried fails and it appears to be down to the escaping of certain characters. wget -q www.anywebpage.com -O - | tr '\r' '\n' | tr \' \ | sed -n 's/.*url=\([^]*\).*/\1/p' If your problem is getting a python string without worrying about how to escape the escape sequences, try: rwget -q www.anywebpage.com -O - | tr '\r' '\n' | tr \' \ | sed -n 's/.*url=\([^]*\).*/\1/p' You should be able to pass this directly to a popen() function. Hi, Thanks for replying however I have just tried that and it does not seem to work, it doesnt return any results (i take it the r was a typo) Thanks RiGGa No, the r was the point - it's there to tell Python not to do any escaping on the string. Try it again with the r and see what happens. Brilliant!!! that works a treat thankyou!!, where on earth did you find out about the 'r' any pointers to documentation appreciated. Thanks RiGGa -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I Fill in web form and post back
Joe Francia wrote: Rigga wrote: Hi, I am looking for the best way to use Python to get a web page, look for some particular fields on a form, fill in the fields and submit the form but I have no idea where to start - any pointers appreciated many thanks Rigga Here's a pretty good resource: http://www.google.com/search?q=python+fill+web+forms Thanks but I already checked there and didnt come up with much -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I Fill in web form and post back
Joe Francia wrote: On Wed, 16 Feb 2005 19:05:35 GMT, Rigga [EMAIL PROTECTED] wrote: Joe Francia wrote: Rigga wrote: Hi, I am looking for the best way to use Python to get a web page, look for some particular fields on a form, fill in the fields and submit the form but I have no idea where to start - any pointers appreciated many thanks Rigga Here's a pretty good resource: http://www.google.com/search?q=python+fill+web+forms Thanks but I already checked there and didnt come up with much Really? The second link is for ClientForm, the description of which reads: ClientForm is a Python module for handling HTML forms on the client side, useful for parsing HTML forms, filling them in and returning the completed forms to the server. That seems to exactly fulfil your requirements. Are you sure you really looked? Yep definately looked, but overlooked that, wasnt really looking for a premade routine to do it all but I can learn from that! thanks for pointing it out, looks like what I need Thanks -- http://mail.python.org/mailman/listinfo/python-list
How can I Fill in web form and post back
Hi, I am looking for the best way to use Python to get a web page, look for some particular fields on a form, fill in the fields and submit the form but I have no idea where to start - any pointers appreciated many thanks Rigga -- http://mail.python.org/mailman/listinfo/python-list
How do I cut parts from a text file
Hi, I am new to Python and need to parse a text file and cut parts out i.e. say the text file contained 5 rows of text: line 1 of the text file line 2 of the text file line 3 of the text file line 4 of the text file line 5 of the text file And the text I want starts at line 2 and goes through to line 4, what is the best way to cut this text out? I guess I need to mark the start and end of the text and then pass these values to a command which will chop the file at that location however I am at a loss. Any advice or pointers of where to find more info would be greatly appreciated. Thanks RiGGa -- http://mail.python.org/mailman/listinfo/python-list