[python-win32] Library not Registered Error while running
Date: Fri, 14 Mar 2008 12:59:26 + From: Tim Golden [EMAIL PROTECTED] Subject: Re: [python-win32] Library not Registered Error while running WMI example script Cc: python-win32@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed siddhartha veedaluru wrote: I have installed win32 extensions on my windows 2003 server i'm using python 2.5.1. downloaded the wmi module 1.3.2 to my machine used python setup.py install to install the module i tried run an example mentioned in the web page. it gave the following error. File C:\Python25\Lib\site-packages\wmi.py, line 157, in __init__ comobj._oleobj_.GetTypeInfo().GetContainingTypeLib()[0].GetTypeComp() pywintypes.com_error: (-2147319779, 'Library not registered.', None, None) Script terminated. Just to test, could you run this code to see if it produces the same result? (This is basically what the wmi module does behind the scenes). code import win32com.client win32com.client.GetObject (winmgmts:) /code TJG --- Hi , I have tried the snipped The script just terminted with any output or error. Thanks Siddhartha. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Library not Registered Error while running
siddhartha veedaluru wrote: From: Tim Golden [EMAIL PROTECTED] Just to test, could you run this code to see if it produces the same result? (This is basically what the wmi module does behind the scenes). code import win32com.client win32com.client.GetObject (winmgmts:) /code TJG --- Hi , I have tried the snipped The script just terminted with any output or error. Well that's a shame (for me): it means that WMI is working ok on your machine in general... although I'd have been surprised if that weren't the case! Just to narrow down, could you run these lines in the interpreter to see if/where the error comes up: code import wmi c = wmi.WMI () c.Win32_OperatingSystem () /code Thanks TJG ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Library not Registered Error while running
Hi Tim, I tried the snippet you sent to me. Same error. i opened the python shell and gave import wmi It give the same error. comobj._oleobj_.GetTypeInfo().GetContainingTypeLib()[0].GetTypeComp() com_error: (-2147319779, 'Library not registered.', None, None) Thanks for your responce. Siddhartha On Mon, Mar 17, 2008 at 4:30 PM, [EMAIL PROTECTED] wrote: Send python-win32 mailing list submissions to python-win32@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/python-win32 or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of python-win32 digest... Today's Topics: 1. Library not Registered Error while running (siddhartha veedaluru) 2. Re: Library not Registered Error while running (Tim Golden) -- Message: 1 Date: Mon, 17 Mar 2008 12:07:55 +0530 From: siddhartha veedaluru [EMAIL PROTECTED] Subject: [python-win32] Library not Registered Error while running To: python-win32@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Date: Fri, 14 Mar 2008 12:59:26 + From: Tim Golden [EMAIL PROTECTED] Subject: Re: [python-win32] Library not Registered Error while running WMI example script Cc: python-win32@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed siddhartha veedaluru wrote: I have installed win32 extensions on my windows 2003 server i'm using python 2.5.1. downloaded the wmi module 1.3.2 to my machine used python setup.py install to install the module i tried run an example mentioned in the web page. it gave the following error. File C:\Python25\Lib\site-packages\wmi.py, line 157, in __init__ comobj._oleobj_.GetTypeInfo().GetContainingTypeLib()[0].GetTypeComp() pywintypes.com_error: (-2147319779, 'Library not registered.', None, None) Script terminated. Just to test, could you run this code to see if it produces the same result? (This is basically what the wmi module does behind the scenes). code import win32com.client win32com.client.GetObject (winmgmts:) /code TJG --- Hi , I have tried the snipped The script just terminted with any output or error. Thanks Siddhartha. -- next part -- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20080317/cf718808/attachment-0001.htm -- Message: 2 Date: Mon, 17 Mar 2008 08:34:27 + From: Tim Golden [EMAIL PROTECTED] Subject: Re: [python-win32] Library not Registered Error while running Cc: python-win32@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed siddhartha veedaluru wrote: From: Tim Golden [EMAIL PROTECTED] Just to test, could you run this code to see if it produces the same result? (This is basically what the wmi module does behind the scenes). code import win32com.client win32com.client.GetObject (winmgmts:) /code TJG --- Hi , I have tried the snipped The script just terminted with any output or error. Well that's a shame (for me): it means that WMI is working ok on your machine in general... although I'd have been surprised if that weren't the case! Just to narrow down, could you run these lines in the interpreter to see if/where the error comes up: code import wmi c = wmi.WMI () c.Win32_OperatingSystem () /code Thanks TJG -- ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 End of python-win32 Digest, Vol 60, Issue 26 ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] python-win32 Digest, Vol 60, Issue 26
siddhartha veedaluru wrote: Hi Tim, I tried the snippet you sent to me. Same error. i opened the python shell and gave import wmi It give the same error. comobj._oleobj_.GetTypeInfo().GetContainingTypeLib()[0].GetTypeComp() com_error: (-2147319779, 'Library not registered.', None, None) Aha. That's what I wanted to know. (In fact, now I look at your original post, the same information's shown there. Shame on me for not checking). It *looks* as though one (or more) of the WMI DLLs which in my system are in c:\windows\system32\wbem need to be reregistered. It might be something else, however. Can you try running regsvr32.exe against the DLLs in (your equivalent of) c:\windows\system32\wbem? I'm sorry this is so involved: I've never encountered someone with this error before when running WMI. TJG ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Skip Alt+F4
Oh yes ! That's it. Thank you. It is a frame that's used by a service to display some information before uncancelable forced reboot. I now have to determinate how to modify the informations displayed in the frame. Should my program run in the class of the frame ? Or should it get a sort of handler to the frame and modify the content of a text box ? I don't know if the second way is possible. Paul Moore a écrit : On 17/03/2008, le dahut [EMAIL PROTECTED] wrote: I'm writting a Wx app and I want to skip Alt+F4. I've used somehting like that : def OnKeyDown(self, event): print event.AltDown(), event.GetKeyCode() if event.AltDown() and event.GetKeyCode() == wx.WXK_F4: print 'try to close' Everything gets printed but my app closes anyway on Alt+F4, is there a way to skip this ? (a) you should think hard before doing this - about the only reasonable reason for overriding the standard Alt-F4 on Windows, is to minimise to the tray rather than closing (b) if you still want to do this, look at the OnClose event, and override that. Paul. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Running SQL queries on excel sheets
Thanks John, I'll check that out. -Kyle Rickey -Original Message- From: John Machin [mailto:[EMAIL PROTECTED] Sent: Sunday, March 16, 2008 4:40 AM To: Rickey, Kyle W Cc: python-win32@python.org Subject: Re: [python-win32] Running SQL queries on excel sheets Rickey, Kyle W wrote: Tim, thanks for your response. I've got 7 excel files that need reading containing a total of ~6100 rows. I agree, about this code making me sick :) That's not exactly absolutely tons of data :-) One problem with the ODBC approach to reading spreadsheets (at least with the MS Excel ODBC driver) is that it examines a limited number (e.g. 8 or 10) of rows to determine what type a column is. So the first 10 rows have floats in column X then Noddy's managed to get some text in cell X11 which is a fatal error for ODBC -- you can't continue. [snip] Obviously, all that is only helpful up to a point. Is there some reason why you can't just pull the data out straight into Python structures and take it from there (or even push it into a Sqlite memory database)? Perhaps you've got absolutely tons of data so extracting it would be a pain? If not, consider using one of the COM packages (win32com.client or comtypes) or something like pyExcelerator to pull it out. /more helpful Consider the xlrd package (http://www.lexicon.net/sjmachin/xlrd.htm). It'll tell you what type the data is cell-by-cell -- you can then compare that with your expectations. HTH, John ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] How to create a com_record?
In case it helps, here's the overall description of the COM/app and what how this function fits: COM_App is a typelib (with multiple classes) for interfacing to an application that controls hardware on a USB port. When multiple applications are started it becomes impossible for users to write code for accessing a particular instance of the app, therefore a manager com COM_Manager was created. There are two important level of the COM_Manager. The first call gets you an object representing the particular application (Its not really COM_App per-se, its just another object that handles that app). Then there is SomeFunction below, it gives you the particular class for the particular COM_App. That is why it is takes a GUID as a parameter. I'm still learning about the details of the COM, I guess VT_RECORD is sort of the standard way of passing any structure information back and forth? My email access for the first half of the week is fairly limited but I'll still try to learn my way around the test harness to see if I can create an example. On Sat, Mar 15, 2008 at 12:54 PM, Mark Hammond [EMAIL PROTECTED] wrote: Just to clarify: HRESULT SomeFunction( [in] GUID* pGuid, [out, retval, iid_is(pGuid)] IUnknown** ppUnknown); win32com says that it needs a VT_RECORD in order to pass the GUID information to the COM. But from previous email exchanges I can't just deifne some GUID My understanding is that the IDispatch implementation of this method declares that it wants a VT_RECORD - which win32com is trying to comply with. When I get back home, my approach will be to simply try and repro the issue in the win32com test suite, which will at least give me a clearer picture of what is happening. If Kevin could take some steps towards this it would help. Cheers, Mark ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Confusion with 'SetForegroundWindow()
Greets... I'm looking to use the win32api and win32gui modules to do a bit of Windows tinkering (win2k, ActiveState's Python 2.4.1 distribution) and I've hit a snag. I'd like to have my process/window steal the focus from whatever window currently has it, get a bit of input from the keyboard, and then restore the focus back to the original window. In simple cases win32gui.SetForegroundWindow(hwnd) seems to be what I'm looking for. It works fine when I simply try to set focus to another window from my app. But, I'm seeing unexpected behavior when I go beyond that. I wrote a simple test script that enumerates through all visible windows and tries to give each one the focus in turn, after a short delay. It gets through 1-2 windows out of the 8-10 non-minimized windows I have open (IE, notepad, wordpad, etc.) and then gives me this: Traceback (most recent call last): File D:\_code\python\apps\WinTests.py, line 25, in ? cycle_foreground() File D:\_code\python\apps\WinTests.py, line 20, in cycle_foreground win32gui.SetForegroundWindow(handle) pywintypes.error: (0, 'SetForegroundWindow', 'No error message is available') What am I doing wrong in this case? Do I have some bad assumptions? Is my app allowed to give away its focus but can't force a different app's window with focus to give away its focus? Is there any other way to accomplish this? I've attempted using a mix of SetFocus(), BringWindowToTop(), and EnableWindow() but couldn't find a magic combo. I've attached my test script. Run it as WinTests cycle to attempt to cycle the focus through all top level windows and see the traceback. Run it as WinTests 12345 to successfully set the focus to the window with hwnd of 12345. Run it as WinTests to get a list of all top level window names and their hwnd's. I've tried reading the win32 docs provided with ActiveState's PythonWin, I've read a bit on the win32 API on MSDN and I've googled around a bit, and haven't found much. So, I got curious and tried to code up something similar in C++. It uses the identical API calls (from what I can tell) and It seems to have no problem cycling through all the top-level windows. I've attached my .cpp file as well. Why the discrepancy between what I'm seeing with win32gui and c++? Thoughts? -Scott #include iostream #include windows.h using namespace std; HWND winlist[256]; BOOL EnumWindowsProc(HWND hWnd, long lParam) { if (IsWindowVisible(hWnd)) { char winName[256]; GetWindowText(hWnd, winName, 256); cout Window: hWnd \t winName endl; Sleep(2000); BOOL result = SetForegroundWindow(hWnd); cout \tResult: result endl; } return TRUE; } int main() { EnumWindows((WNDENUMPROC)EnumWindowsProc, 0); } /* win32.programmer.ui http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.win32.programmer.uilang=encr=US HWND handle = FindWindow( NULL,blabla - Mozilla Firefox); if (handle) { SetForegroundWindow(handle); hDC = GetDC(handle); if (hDC){ COLORREF color = GetPixel(hDC, Xmin+x*30,Ymin+y*30); wsprintf(msg, %X, color); MessageBox (handle, msg, test, MB_OK); } } */import win32gui import time import sys import win32con def win_enum_callback(hwnd, results): if win32gui.IsWindowVisible(hwnd) and win32gui.GetWindowText(hwnd) != '': results.append(hwnd) def print_list(): handles = [] win32gui.EnumWindows(win_enum_callback, handles) print '\n'.join(['%d\t%s' % (h, win32gui.GetWindowText(h)) for h in handles]) def cycle_foreground(): handles = [] win32gui.EnumWindows(win_enum_callback, handles) for handle in handles: print handle, win32gui.GetWindowText(handle) win32gui.SetForegroundWindow(handle) time.sleep(2.0) if __name__ == '__main__': if len(sys.argv) == 2 and sys.argv[1] == 'cycle': cycle_foreground() sys.exit(0) if len(sys.argv) == 2: win32gui.SetForegroundWindow(int(sys.argv[1])) else: print_list() ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] python 2.5
I want to use python win32 extensions on python 2.5 but it seems like they were built for 2.3... I copied the win32 folders from C:\python23\lib\site-packages to C:\python25\lib\site-packages but it does not work Is there a workaround ? anyone using it ? -TK Disclaimer This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the sender. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] python 2.5
Tarun Kapoor wrote: I want to use python win32 extensions on python 2.5 but it seems like they were built for 2.3… the newer builds are on sourceforge, including ones for Python 2.5 and 2.6. https://sourceforge.net/project/platformdownload.php?group_id=78018 Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] python 2.5
Worked !! Mucho Gracias ! -Original Message- From: Werner F. Bruhin [mailto:[EMAIL PROTECTED] Sent: Monday, March 17, 2008 1:06 PM To: Tarun Kapoor Cc: python-win32@python.org Subject: Re: python 2.5 Tarun Kapoor wrote: I want to use python win32 extensions on python 2.5 but it seems like they were built for 2.3... the newer builds are on sourceforge, including ones for Python 2.5 and 2.6. https://sourceforge.net/project/platformdownload.php?group_id=78018 Werner Disclaimer This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the! sender. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] python 2.5
Tarun Kapoor wrote: I want to use python win32 extensions on python 2.5 but it seems like they were built for 2.3… I copied the win32 folders from C:\python23\lib\site-packages to C:\python25\lib\site-packages but it does not work…. Is there a workaround ? anyone using it ? For future reference, a Python extension written in C only works for a single major version. That is, an extension built for 2.4.1 will work with any 2.4 version, but not with 2.3 or 2.5. This is because the Python interpreter actually lives in a DLL (python23.dll, python24.dll. python25.dll), and the extension must link with a single version of that DLL. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Confusion with 'SetForegroundWindow()
Scott Nelson wrote: I'm looking to use the win32api and win32gui modules to do a bit of Windows tinkering (win2k, ActiveState's Python 2.4.1 distribution) and I've hit a snag. I'd like to have my process/window steal the focus from whatever window currently has it, get a bit of input from the keyboard, and then restore the focus back to the original window. ... But, I'm seeing unexpected behavior when I go beyond that. I wrote a simple test script that enumerates through all visible windows and tries to give each one the focus in turn, after a short delay. It gets through 1-2 windows out of the 8-10 non-minimized windows I have open (IE, notepad, wordpad, etc.) and then gives me this: Traceback (most recent call last): File D:\_code\python\apps\WinTests.py, line 25, in ? cycle_foreground() File D:\_code\python\apps\WinTests.py, line 20, in cycle_foreground win32gui.SetForegroundWindow(handle) pywintypes.error: (0, 'SetForegroundWindow', 'No error message is available') What am I doing wrong in this case? ... I've attached my test script. Run it as WinTests cycle to attempt to cycle the focus through all top level windows and see the traceback. Your test runs to completion without error on my XP machine. Is it always the same window that causes it to explode? You didn't say what window it is. It is possible that there are some applications that do not want to become foreground unless it was their idea. SetForegroundWindow sends a WM_ACTIVATE message, and the application can veto the suggestion. Also, an application can call LockSetForegroundWindow to prevent another application from stealing the focus away. You may simply need to trap this error. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32