[Tutor] Is it possible to use sockets to login to a website that uses php?
I need to some how make a script that logs into a website from my desktop and I can do the rest and grab the information on my on hopefully. How would I login to a website using sockets with python? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrong version of Python being executed
I've found something interesting regarding this issue. I went to Windows Explorer, Tools,Folder Options, File Types and noticed that there are two different icons associated with .PY files. The Icon for Python 2.5 is easy to recognize as compared with the icon for Python 2.3. So I've changed the association from the 2.3 icon to the 2.5 icon, and now I can run my script from the command line as follows python script.py, and the correct version of Python is invoked. This is very disturbing because it means the path or other env vars have no control (or very little) as to which version of Python is invoked. How do other people deal with having multiple versions of Python on their system, and not run into this issue?? On Nov 10, 2007 6:16 PM, Kent Johnson [EMAIL PROTECTED] wrote: Tony Cappellini wrote: When I run this python script, the following exception is thrown, implying that it is being executed with Python 2.3 So I've added this print statement to the main function, which shows the logging module is being imported from the Python 2.3 directory print\nlogging.__file__ = %s % logging.__file__ logging.__file__ = C:\Python23\lib\logging\__init__.pyc Traceback (most recent call last): File c:\Project\myscript.py, line 584, in ? main(sys.argv) File c:\Project\myscript.py, line 518, in main logging.basicConfig(level=config.verbosity,format='%(message)s') TypeError: basicConfig() takes no arguments (2 given) The really odd thing is when I bring up the python interpreter at the same command prompt where i ran the script above, Python 2.5 is invoked, as seen by Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import sys sys.version '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]' How is it that running a script invokes Python 2.3, but running the interpreter without the script invoked Python 2.5? A couple of possibilities... Is there a #! line at the start of the script that specifies Python 2.3 (I'm not sure if those work in windows though...) How do you run the script? If you double-click it, perhaps the file association with .py files is to Python 2.3? Conceivably the Python 2.5 module path is incorrect and imports the wrong module. What happens if you import logging from the interpreter prompt and print its file? What do you get if you print sys.path from the interpreter? HTH, Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Windows - Linux based open() file handle mode
Dear group, I want to parse an file generated for windows. My code works beautifully when I try to parse the same file generated in Linux. I uses the following options with no success: blast_out = open('C:\human\prb_blast.out','r') blast_out = open('C:\human\prb_blast.out','rU') blast_out = open('C:\human\prb_blast.out','U') Are there any other ways to solve this problem. Since the question is more of biopython question I posted detailed question on biopython forum. apologies for any inconvenience. thanks srini Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Windows - Linux based open() file handle mode
Srinivas Iyyer wrote: Dear group, I want to parse an file generated for windows. My code works beautifully when I try to parse the same file generated in Linux. I uses the following options with no success: blast_out = open('C:\human\prb_blast.out','r') blast_out = open('C:\human\prb_blast.out','rU') blast_out = open('C:\human\prb_blast.out','U') Presumably the file is a text file? What kind of error do you get? Have you looked at the file and compared it with the same file generated on Linux? Are you using a recent version of Python? (the U options were introduced in 2.3) Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Windows - Linux based open() file handle mode
On Mon, Nov 19, 2007, Srinivas Iyyer wrote: Dear group, I want to parse an file generated for windows. My code works beautifully when I try to parse the same file generated in Linux. I uses the following options with no success: blast_out = open('C:\human\prb_blast.out','r') blast_out = open('C:\human\prb_blast.out','rU') blast_out = open('C:\human\prb_blast.out','U') Are there any other ways to solve this problem. Try blast_out = open('C:/human/prb_blast.out', 'U') instead of the $DEITY/Awful DOSish backwacks. If you're really enamoured of backslashes, add an r before the single quotes to get what you want. blast_out = open(r'C:\human\prb_blast.out','U') Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 There is nothing as stupid as an educated man if you get him off the thing he was educated in. Will Rogers ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Windows - Linux based open() file handle mode
Bill Campbell [EMAIL PROTECTED] wrote blast_out = open('C:\human\prb_blast.out','U') Are there any other ways to solve this problem. Try blast_out = open('C:/human/prb_blast.out', 'U') instead of the $DEITY/Awful DOSish backwacks. If you're really enamoured of backslashes, add an r before the single quotes to get what you want. And the reason is that \ is the escape character in Python strings so \h is seen as just h and \p as p. if you had a \t it would be seen as a tab character etc. So to avoid that either tell Python to ignore the escapes by using r(raw string) or use forward slashes which work just as well in Windows as in Linux... You'll find more on this in the side bar in my File Handling topic, about 1/3 of the way down the page. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Wrong version of Python being executed
Tony Cappellini [EMAIL PROTECTED] wrote So I've changed the association from the 2.3 icon to the 2.5 icon, and now I can run my script from the command line as follows python script.py, and the correct version of Python is invoked. This is very disturbing because it means the path or other env vars have no control (or very little) as to which version of Python is invoked. There are multiple mechanisms. The PATH and env vars should take precedence inside a DOS box but from Explorer or from Start-Run its the registry settings that matter. How do other people deal with having multiple versions of Python on their system, and not run into this issue?? By using one under cygwin and the other under Windows. I currently have 2.5 installed in cygwin but 2.4 in Windows... (and 2.5 and 2.3 installed in MacOS - and 2.2 on Linux!) Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor