Need help with TCP/IP client access from Windows

Eric S. Raymond esr at thyrsus.com
Fri Jul 30 00:52:11 EDT 1999


Gordon McMillan <gmcm at hypernet.com>:
> No problem there. (The only difference - when using Python - is that 
> you can only select on sockets on Windows).

So you're saying my blocking-socket code will work as-is?  Great.  The
Python manual implies otherwise...
  
> > (2) How does one read and write the Windows equivalent of a dotfile?
> >     Must this involve the (shudder) registry?
> 
> You could, by using Mark's win32 extensions. MS would prefer you
> kept this kind of info in the registry, but that doesn't stop
> anybody, least of all you <g>.
> 
> The issue is really what is meant by a HOME directory. On NT, this 
> has a certain amount of meaning - there's probably a 
> %WINDIR%/profiles/%USERNAME% directory tree for that user (where 
> those funky %...% things are environment vars), but probably it's 
> safer to get that path out of the registry. On Win9x, it's pretty 
> meaningless, since a logon and username are pretty much an empty 
> formality. There's almost no way to keep multiple users on a Win9x 
> box from stepping on each other. (Of course, I mean multiple serial 
> users; the only possible kind in Windows).

Hm..."serial users".  I like that.  It just...*sounds right* for Windows.

:-)
 
> Probably better just to have a default file, and let the user 
> override that if need be. Which may well never happen.

OK, but where to put it?  I don't know what the conventions are.

> > (3) Is there a reliable way for Python programs under Windows to
> > point a local
> >     browser at a specified URL?
> 
> The best way is to use WinExec from Mark's win32 extensions. You just 
> give it the URL and it loads the user's default browser. Using 
> os.system is harder, because most of the time a browser is not on the 
> user's path.

Are these in the stock 1.5.2 Windows distribution?

> However, this worked fine for me:
> 
> browse='"C:\\Program Files\\Netscape\\Communicator\\Program\\netscape"
> %s'
> 
> Note the double quotes around the nowhere-but-Windows <snicker> path 
> with spaces in it, and that argv[1] is expected to be a URL (same for 
> IE). Also note that the path doesn't go thru the c runtime lib, so 
> those wonderful backslashes can't be avoided.

Got it.  Thanks.
-- 
		<a href="http://www.tuxedo.org/~esr">Eric S. Raymond</a>

Our society won't be truly free until "None of the Above" is always an option.




More information about the Python-list mailing list