Re: [python-win32] user currently connected

2005-10-20 Thread Tim Golden
[le dahut]

 How can I get the name of a user currently connected on a windows
workstation ? I mean a sort of whoami.

code
import getpass
getpass.getuser ()
/code

Or

code
import win32api
win32api.GetUserName ()
/code

Or

code
import os
os.environ['USERNAME']
/code

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Access to the DHCP Client API

2005-10-20 Thread Gaspard, Bradley S








Is it possible to access Windows DHCP Client API using
Pythons win32 extensions? I couldnt find any information on the
web.






___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] detect file modification event

2005-10-20 Thread Jim Vickroy
Sorry if this has been previously answered, but my search failed to 
detect it.

Could someone refer to information on how to detect file modification 
(e.g., update) events in MS Windows?

Thanks,

-- jv
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] detect file modification event

2005-10-20 Thread Tim Golden
[Jim Vickroy]

 Sorry if this has been previously answered, but my search failed to
detect it.
 Could someone refer to information on how to detect file modification
(e.g., update) events in MS Windows?

Is this the sort of thing you were after?

http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes
.html

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Re: Access to the DHCP Client API

2005-10-20 Thread Roger Upole
Gaspard, Bradley S  wrote:
 Is it possible to access Windows DHCP Client API using Python's win32 
 extensions?
 I couldn't find any information on the web.

None of the Dhcp functions are wrapped, but depending on what you're
trying to accomplish, you might be able use use WMI.
The Win32_NetworkAdapterConfiguration class has several methods
and properties related to Dhcp.

   hth
   Roger


___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] String weirdness on python 2.4 / windows

2005-10-20 Thread Tim Roberts
On Wed, 19 Oct 2005 09:51:32 +1000, Kinsley Turner 
[EMAIL PROTECTED] wrote:

Hey-ho,

I'm having a problem with some binary data read into a string.

Basically I open an icon file rb, read() it into a string, then
spit it back down on a web request for /favicon.ico.

It works fine under unix, but under Win32 Python 2.4.2 (#67, Sep 28 2005 
...
It comes back corrupted.

Similiarly I have a string with the IBM-extended-ASCII degrees symbol 
(ascii 0xb0) 
that is read in from a network-connected field device.  Somehow this ends 
up with 
an extended 'A' (with a single dot over it.) prepended before it.

Is there some sort of new 2.4 string encoding option I've missed ?
Never seen anything like this before.

I have the # -*- coding: iso-8859-1 -*- atop my files.



Are you writing this as a CGI process in Apache/Win32?  Have you 
redefined your stdout to be binary?  By default, Python opens its stdout 
as binary, so when you write this out to the socket, the file system 
will helpfully translate 0A to 0D/0A.  You need something like this:

import msvcrt
msvcrt.setmode( 0, os.O_BINARY )
msvcrt.setmode( 1, os.O_BINARY )

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] create user message for wxPython

2005-10-20 Thread James Hu
Hi,

There are 2 wxPython application, A and B and need to exchange msg.
Sending WM_CLOSE, wxEVT_MOUSEWHEEL to B is OK, and sending user message
like 1225 from A to B is also OK. 

But B didn't catch this message, note, B is running before A sends msg
and can receive WM_CLOSE. 

Do I have to make my own msg loop by using win32api, win32gui? I used
win32gui to post Message to other windows.

Using wx.Frame:

wx.EVT_START_MSG= 1225
EVT_START_MSG_EVENT= wx.PyEventBinder(wx.EVT_START_MSG, 0)


EVT_START_MSG_EVENT(self, self.OnStart)
Or 
Self.Bind(EVT_START_MSG_EVENT,self.OnStart)

def OnStart(self, event):
  print 'got start message'

Thanks a lot in advance!

James
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32