[python-win32] rename computer

2011-12-19 Thread cd
hello I didn't find any example of howto rename a windows computer with python ? i've tried with wmi unsuccessfully thanks for any halps Christophe ___ python-win32 mailing list python-win32@python.org

Re: [python-win32] rename computer

2011-12-19 Thread Tim Golden
On 19/12/2011 11:57, cd wrote: hello I didn't find any example of howto rename a windows computer with python ? i've tried with wmi unsuccessfully What did you try with WMI, and what happened? TJG ___ python-win32 mailing list

Re: [python-win32] rename computer

2011-12-19 Thread cd
thanks it works but I prefere to use a builtin system call or somethings like this, in order to avoid invalid hostname. I hope wmi can valid hostname for me Message du 19/12/11 14:31 De : Scott Leerssen A : cd Copie à : Objet : Re: [python-win32] rename computer On Dec 19,

Re: [python-win32] rename computer

2011-12-19 Thread cd
import wmi c = wmi.WMI().Win32_ComputerSystem computer = c()[0] for propertyName in sorted( list( c.properties ) ): if propertyName == 'Name': print setattr( computer, propertyName, 'newname' ) ... Traceback (most recent call last): File , line 3, in File C:\Python27\lib\site-packages\wmi.py,

Re: [python-win32] rename computer

2011-12-19 Thread cd
thanks genius it works !! Message du 19/12/11 15:34 De : Tim Golden A : python-win32@python.org Copie à : Objet : Re: [python-win32] rename computer On 19/12/2011 14:20, cd wrote: import wmi c = wmi.WMI().Win32_ComputerSystem computer = c()[0] for propertyName in sorted(

Re: [python-win32] rename computer

2011-12-19 Thread Tim Golden
On 19/12/2011 14:32, Tim Golden wrote: code import wmi c = wmi.WMI () for system in c.Win32_ComputerSystem (): system.Rename (NEW-NAME, TIM, PASSWORD) /code For the record, the OP reported in private email that this solution works for him. TJG ___

[python-win32] Several, totally isolated Python interpreters in the same process

2011-12-19 Thread Thomas Heller
I made an experiment that I wanted to share because it is imo kind of cool: I managed to embed a second Python interpreter in a Python process, with help of WinSxS (WinSxS is a Microsoft technology that allows to isolate plugins from other plugins, or from the calling process). The second

[python-win32] wrapping a IUnknown pointer into a Dispatch interface

2011-12-19 Thread Sébastien de Menten
Hello, I am using a call to a windows function via ctypes to retrieve a pointer to the IDispatch interface of an Excel application, something like: oledll.oleacc.AccessibleObjectFromWindow(hnd, OBJID_NATIVEOM, byref(automation.IDispatch._iid_), byref(pointer_idispatch)) where hnd is the window

Re: [python-win32] send message remote host

2011-12-19 Thread Tim Roberts
pacopyc pacopyc wrote: Yes, I'm thinking about net send of Windows As Google would have told you, net send uses the API NetMessageBufferSend, which is in the win32net module in PyWin32. There are samples on the Internet, although you might have to translate the C++ to Python. -- Tim Roberts,

Re: [python-win32] Problem with Dispatch in normal Python shell

2011-12-19 Thread Mark Hammond
I'm afraid it looks like the object itself has a problem when running outside a GUI environment. You might like to see if you can use Windows Scripting Host (cscript.exe) to load the object but I suspect that might fail in the same way. If so, your best bet might be to talk to the vendor.

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Mark Hammond
On 18/12/2011 4:34 AM, Scott Leerssen wrote: On Dec 17, 2011, at 12:25 PM, Amaury Forgeot d'Arc wrote: 2011/12/17 Scott Leerssen sleers...@gmail.com mailto:sleers...@gmail.com I did see that, but I interpreted that to mean that the PyHANDLE would be dereferenced from the underlying

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Scott Leerssen
On Dec 19, 2011, at 4:32 PM, Mark Hammond wrote: On 18/12/2011 4:34 AM, Scott Leerssen wrote: On Dec 17, 2011, at 12:25 PM, Amaury Forgeot d'Arc wrote: 2011/12/17 Scott Leerssen sleers...@gmail.com mailto:sleers...@gmail.com I did see that, but I interpreted that to mean that the

[python-win32] Problem : COM with Array Argument

2011-12-19 Thread Rand Batchelder
I ran makepy on the DesignCad 20 type library. I get Type mismatch errors with the function GetPoints: a subset of the class definition is: class IDcadEntity(DispatchBaseClass):     CLSID = IID('{B4D5DA6E-EDEB-4816-BD4C-88C04C119C24}')     coclass_clsid =

Re: [python-win32] Problem : COM with Array Argument

2011-12-19 Thread Tim Roberts
Rand Batchelder wrote: I ran makepy on the DesignCad 20 type library. I get Type mismatch errors with the function GetPoints: ... def GetPoints(self, iStartIndex=defaultNamedNotOptArg, iCount=defaultNamedNotOptArg, pXYZArray=defaultNamedNotOptArg): return self._ApplyTypes_(15,

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Amaury Forgeot d'Arc
2011/12/19 Scott Leerssen sleers...@gmail.com I just tried that, and after closing the file object and attempting to call win32api.ClosHandle() on the value returned by detach, I get an exception of error: (6, 'CloseHandle', 'The handle is invalid.') Here's what the code looks like:

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Scott Leerssen
On Dec 19, 2011, at 7:38 PM, Amaury Forgeot d'Arc wrote: 2011/12/19 Scott Leerssen sleers...@gmail.com I just tried that, and after closing the file object and attempting to call win32api.ClosHandle() on the value returned by detach, I get an exception of error: (6, 'CloseHandle', 'The