Code run from IDLE but not via double-clicking on its *.py

n00m n00m at
Wed Aug 31 19:28:42 CEST 2005

Richie; Steve; Thanks for your replies!

>  o The command you're typing into the command prompt
>  o The error message you're getting
>  o The full traceback
>  o The code you're trying to run, or if it's too big then the piece that
>    the last line of the traceback refers to

D:\>python23\python d:\python23\ [Enter]

It's OK so far. Python code is launched and starts listening
to port 1434 (see the code below; it's the same code as in my
neibouring topic).
Now I launch a vbs script (which will connect to port 1434).
I.e. I just double-click "my.vbs" file.
And... voila! In a moment & silently console window closes
without any error messages (or I just don't see them).
But VBS reports a network error. Tested on win2k and win98.

In IDLE it works ABSOLUTELY FINE! Prints statements in the
code do exactly what they must do.

import socket, thread
host, port = '', 1434
s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.connect((host, 1433))
s1.bind((host, port))
cn, addr = s1.accept()

def VB_SCRIPT():
    while 1:
        data = cn.recv(4096)
        if not data: return
        print 'VB_SCRIPT:' + data + '\n\n'

    while 1:
        data = s2.recv(4096)
        if not data: return
        print 'SQL_SERVER:' + data + '\n\n'


More information about the Python-list mailing list