From aloys at alamaison.fr Wed Sep 1 10:02:10 2004 From: aloys at alamaison.fr (Aloys Baillet) Date: Wed Sep 1 10:02:14 2004 Subject: [python-win32] Re: wmi + pythonservice : multithreading issue s In-Reply-To: <1xhnt6c3.fsf@python.net> References: <1xhnt6c3.fsf@python.net> Message-ID: Hello Thomas, I actualy do it that way! For my service, I run the same code in a command prompt, and when everything is fine, I build the service with py2exe. Unless you mean building the service with pywin32, test it, and finally build the py2exe service? That's a longer way... Thomas Heller wrote: > Aloys Baillet writes: > > >>And finally, for the service, I didn't try with the pywin32 service, and >>I totally believe you if you say it works. I just forgot to say that I >>use the py2exe module to generate my service, and I did get the same >>error with it... I will try with the CoInitialize to see if it works! > > > py2exe makes it easy (I believe ;) to create an executable, but you > should only make an exe after you are absolutely sure that you code > works in Python as expected. > > Thomas From cckk_lin at yahoo.ie Thu Sep 2 06:55:39 2004 From: cckk_lin at yahoo.ie (Lin Jingxian) Date: Thu Sep 2 06:55:53 2004 Subject: [python-win32] signature for call COM interface Message-ID: <016c01c490a9$1e0d2ff0$6700a8c0@user03> hi, I use python test my COM interface, there has a method like: int read([in] unsigned char* buf,[in] int len) what's the signature for python to call this method? thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040902/b9bf63ce/attachment.htm From Mark.English at liffe.com Thu Sep 2 12:33:28 2004 From: Mark.English at liffe.com (Mark English) Date: Thu Sep 2 12:33:34 2004 Subject: [python-win32] Problems using makepy Message-ID: <40E605146701DE428FAF21286A97D3091744A7@wphexa02.corp.lh.int> Hi, I'm trying to automate Visual Studio 7.1 with Python, but can't generate one of the type library wrappers with make_py. Running make_py like this: python "c:\Program Files\Python23\Lib\site-packages\win32com\client\makepy.py" "Visual Studio 7.1 Deployment Projects Type library" And getting results like this: Generating to C:\Program Files\Python23\Lib\site-packages\win32com\gen_py\32453F51-EFD3-4D13-8A74 -AB598B93FA57x0x1x0.py Traceback (most recent call last): File "c:\Program Files\Python23\Lib\site-packages\win32com\client\makepy.py", line 369, in ? rc = main() File "c:\Program Files\Python23\Lib\site-packages\win32com\client\makepy.py", line 362, in main GenerateFromTypeLibSpec(arg, f, verboseLevel = verboseLevel, bForDemand = bForDemand, bBuildHidden = hiddenSpec) File "c:\Program Files\Python23\Lib\site-packages\win32com\client\makepy.py", line 266, in GenerateFromTypeLibSpec gen.generate(fileUse, bForDemand) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\genpy.py", line 746, in generate self.do_generate() File "C:\Program Files\Python23\Lib\site-packages\win32com\client\genpy.py", line 806, in do_generate oleItems, enumItems, recordItems, vtableItems = self.BuildOleItemsFromType() File "C:\Program Files\Python23\Lib\site-packages\win32com\client\genpy.py", line 718, in BuildOleItemsFromType oleItem, vtableItem = self._Build_Interface(type_info_tuple) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\genpy.py", line 698, in _Build_Interface vtableItem = VTableItem(info, attr, doc) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\build.py", line 112, in __init__ self.Build(typeinfo, attr, bForUser) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\build.py", line 393, in Build DispatchItem.Build(self, typeinfo, attr, bForUser) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\build.py", line 260, in Build self._AddFunc_(typeinfo,fdesc,bForUser) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\build.py", line 181, in _AddFunc_ arg_type, arg_clsid, arg_doc = _ResolveType(typerepr, typeinfo) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\build.py", line 437, in _ResolveType subrepr, sub_clsid, sub_doc = _ResolveType(subrepr, itypeinfo) File "C:\Program Files\Python23\Lib\site-packages\win32com\client\build.py", line 452, in _ResolveType resultTypeInfo = itypeinfo.GetRefTypeInfo(subrepr) pywintypes.com_error: (-2147312566, 'Error loading type library/DLL.', None, None) I've tried debugging it but get lost as to what property/method is being built. Any ideas how to identify/solve the problem ? Would throwing the error away be acceptable ? This hasn't particularly hampered things yet since the script I'm cobbling together works fine even if the following call fails: gencache.EnsureModule('{32453F51-EFD3-4D13-8A74-AB598B93FA57}', 0, 1, 0) I haven't checked the details but I presume it's doing some late-binding instead (or perhaps I'm just not using any objects from that type library...). Overall the VS7.1 automation model seems a bit buggy so I wouldn't be too surprised if the type library is pushing the boundaries somewhat. I believe it lives here: c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\Deployment\Vspkgs\dpprj.dll I've messed around with win32com\gen_py deleting the relevant generated file, so if there's any other cached info lying around somewhere I should have cleared up please let me know. I didn't see anything in the documentation (yet). Cheers for any assistance, mE ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From mhammond at skippinet.com.au Thu Sep 2 13:16:23 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Sep 2 13:15:55 2004 Subject: [python-win32] Problems using makepy In-Reply-To: <40E605146701DE428FAF21286A97D3091744A7@wphexa02.corp.lh.int> Message-ID: <001501c490de$486d0420$0200a8c0@eden> > resultTypeInfo = itypeinfo.GetRefTypeInfo(subrepr) > pywintypes.com_error: (-2147312566, 'Error loading type library/DLL.', > None, None) typelibs can have references to other typelibs - loading one of these other references is what is failing. > I've tried debugging it but get lost as to what > property/method is being > built. Any ideas how to identify/solve the problem ? Would > throwing the > error away be acceptable ? Yeah, I think ignoring that error would be acceptable, and we could just pretend the sub-reference didn't exist. If you can, please submit a patch to sourceforge. Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 1864 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040902/a699c957/winmail.bin From jens.jorgensen at tallan.com Thu Sep 2 15:37:20 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Thu Sep 2 15:37:32 2004 Subject: [python-win32] signature for call COM interface In-Reply-To: <016c01c490a9$1e0d2ff0$6700a8c0@user03> References: <016c01c490a9$1e0d2ff0$6700a8c0@user03> Message-ID: <41372210.8080802@tallan.com> If that's truly what the IDL looks like then your interface is not Automation compatible, that's for sure. Additionally (and I really am not sure at all on this), I'm not sure that it will even work with makepy though this is just a guess. A better bet might be to try your luck with the ctypes module. The COM stuff there is officially "work in progress" but I've been able to use it successfully a couple of times. http://starship.python.net/crew/theller/ctypes/ BTW, if you have the option of modifying the COM interface there is an Automation-compatible way of having an array of bytes. You can use a SAFEARRAY of uchar. They are a little bit more of a pain to use but that will make them work nicely with scripting languages, etc. Your last option, one that people are ever-reluctant to do, is to write a custom python extension that wraps it. This is so easy to do (well, certainly compared to perl if you're doing it by hand and by this I am specifically ruling out SWIG) if you're comfortable with C. There are even tools that will generate a whole C skeleton for you out there though it's been a while since I've used one. The python tutorial can guide you through this quite well. Lin Jingxian wrote: > hi, > I use python test my COM interface, there has a method like: > int read([in] unsigned char* buf,[in] int len) > > what's the signature for python to call this method? > thanks. > > > >------------------------------------------------------------------------ > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From Mark.English at liffe.com Thu Sep 2 16:02:13 2004 From: Mark.English at liffe.com (Mark English) Date: Thu Sep 2 16:02:16 2004 Subject: [python-win32] Problems using makepy Message-ID: <40E605146701DE428FAF21286A97D3091480B3@wphexa02.corp.lh.int> > > Mark English wrote: > > resultTypeInfo = itypeinfo.GetRefTypeInfo(subrepr) > > pywintypes.com_error: (-2147312566, 'Error loading type > library/DLL.', > > None, None) > MarkHammond wrote: > typelibs can have references to other typelibs - loading one > of these other references is what is failing. Any easy way of telling what the typelib failing is ? Cheers, mE ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From lewis.franklin at gmail.com Fri Sep 3 04:33:55 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Fri Sep 3 04:34:03 2004 Subject: [python-win32] Hidden CLI Message-ID: <80150ed604090219332314493a@mail.gmail.com> My question is probably simple to those who have been programming in Windows for some time, but I am having a difficult time with a 'simple' problem. I have written a program that consists simply of three buttons (using wxPython). Clicking one of those buttons triggers an event where curl is executed and the information returned is stored into a file. The command is simply: curl http://www.example.org?a=user^&b=pass -o setup.bat I can run this command without any problem. However, the 'problem' that arises is that while curl is being run a Command Prompt appears. Since this app is for techno-phobes and can only imagine how much several windows opening and closing on their own would freak them out, I am trying to keep the user from seeing this window. I was wondering if there was a way to run the command without having it open a Command Prompt. I hope that I have been clear enough in stating my question and situation. Thank you in advance for any assistance you can offer. Being new to Python on Windows I need help with what may seem a small task to others. Lewis From tim.golden at viacom-outdoor.co.uk Fri Sep 3 09:34:28 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Sep 3 09:38:26 2004 Subject: [python-win32] Hidden CLI Message-ID: | I have written a program that consists simply of three buttons (using | wxPython). Clicking one of those buttons triggers an event where curl | is executed and the information returned is stored into a file. The | command is simply: | | curl http://www.example.org?a=user^&b=pass -o setup.bat | | I can run this command without any problem. However, the 'problem' | that arises is that while curl is being run a Command Prompt appears. | Since this app is for techno-phobes and can only imagine how much | several windows opening and closing on their own would freak them out, | I am trying to keep the user from seeing this window. I was wondering | if there was a way to run the command without having it open a Command | Prompt. A good option is to use the popen command from the os module, or one of the slightly more powerful alternatives from the popen2 module. In essence, you'll be doing this: f = os.popen ("curl http://www.example.org?a=user^&b=pass -o setup.bat") The f is an open read-only file which contains the output from the command. You can just throw it away if you're not bothered, or you can parse the output for useful information. Example: >>> >>> >>> import os >>> f = os.popen ("dir c:\\") >>> print "".join (f.readlines ()) Volume in drive C has no label. Volume Serial Number is FC4F-7311 Directory of c:\ 28/10/2003 10:29 AM PC Fonts 10/09/2003 15:25 BACKUP 18/06/2004 10:32 531 BARLOWJ_log.txt 21/06/2004 09:24 0 cas.sql 28/10/2003 14:33 529 CHRISF_log.txt . . . HTH Tim ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. 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 ________________________________________________________________________ From lewis.franklin at gmail.com Fri Sep 3 18:21:14 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Fri Sep 3 18:21:19 2004 Subject: [python-win32] Hidden CLI In-Reply-To: References: Message-ID: <80150ed6040903092112371b53@mail.gmail.com> Tim, Thanks for your help. I tried popen and technically, it does work. However, I need a way to make sure it was successful. Since the curl creates a new file, I run the following code afterwards: try: f = open('rsetup.bat', 'r') for line in f: a = line.find('set RSYNC_USER=') if a == 0: user = line[15:].strip() break except: return 1 I continually get an error at level 1 (from the above return) because the file cannot be opened. However, once I exit the program, the file is there and has the proper information. It seems that Python moves on after the pipe is opened instead of waiting for it to complete (which I'm sure is a desired behavior). However, I need to make sure the pipe was successful in (1) creating the file and (2) populating it with the proper information. Is there any suggestions on how I can do this? Lewis On Fri, 3 Sep 2004 08:34:28 +0100 , Tim Golden wrote: > | I have written a program that consists simply of three buttons (using > | wxPython). Clicking one of those buttons triggers an event where curl > | is executed and the information returned is stored into a file. The > | command is simply: > | > | curl http://www.example.org?a=user^&b=pass -o setup.bat > | > | I can run this command without any problem. However, the 'problem' > | that arises is that while curl is being run a Command Prompt appears. > | Since this app is for techno-phobes and can only imagine how much > | several windows opening and closing on their own would freak them out, > | I am trying to keep the user from seeing this window. I was wondering > | if there was a way to run the command without having it open a Command > | Prompt. > > A good option is to use the popen command from the os > module, or one of the slightly more powerful alternatives > from the popen2 module. In essence, you'll be doing this: > > f = os.popen ("curl http://www.example.org?a=user^&b=pass -o setup.bat") > > The f is an open read-only file which contains the output from > the command. You can just throw it away if you're not bothered, > or you can parse the output for useful information. > > Example: > > > >>> > >>> > >>> import os > >>> f = os.popen ("dir c:\\") > >>> print "".join (f.readlines ()) > Volume in drive C has no label. > Volume Serial Number is FC4F-7311 > > Directory of c:\ > > 28/10/2003 10:29 AM PC Fonts > 10/09/2003 15:25 BACKUP > 18/06/2004 10:32 531 BARLOWJ_log.txt > 21/06/2004 09:24 0 cas.sql > 28/10/2003 14:33 529 CHRISF_log.txt > . > . > . > > > HTH > Tim > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star Internet. 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 > ________________________________________________________________________ > From bgailer at alum.rpi.edu Fri Sep 3 18:51:55 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Fri Sep 3 18:51:19 2004 Subject: [python-win32] Hidden CLI In-Reply-To: <80150ed6040903092112371b53@mail.gmail.com> References: <80150ed6040903092112371b53@mail.gmail.com> Message-ID: <6.1.2.0.0.20040903103951.04d73d00@mail.mric.net> At 10:21 AM 9/3/2004, Lewis Franklin wrote: >Tim, > >Thanks for your help. I tried popen and technically, it does work. >However, I need a way to make sure it was successful. Since the curl >creates a new file, I run the following code afterwards: > >try: > f = open('rsetup.bat', 'r') > for line in f: > a = line.find('set RSYNC_USER=') > if a == 0: > user = line[15:].strip() > break >except: > return 1 > >I continually get an error at level 1 (from the above return) because >the file cannot be opened. However, once I exit the program, the file >is there and has the proper information. You can also use os.path.exists(filepath) which returns True if file exists else False. >It seems that Python moves on >after the pipe is opened instead of waiting for it to complete (which >I'm sure is a desired behavior). However, I need to make sure the pipe >was successful in (1) creating the file and (2) populating it with the >proper information. Is there any suggestions on how I can do this? # From os help 6.1.2: "popen: Open a pipe to or from command. The return value is an open # file object connected to the pipe, which can be read or written depending # on whether mode is 'r' (default) or 'w'. " # if you do not assign the returned file object, popen opens and writes the file, then the file is closed # so do the following: f = popen(process) f.readlines() # returns lines written by process to std_out Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From jens.jorgensen at tallan.com Fri Sep 3 19:08:28 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Sep 3 19:08:41 2004 Subject: [python-win32] Hidden CLI In-Reply-To: <80150ed604090219332314493a@mail.gmail.com> References: <80150ed604090219332314493a@mail.gmail.com> Message-ID: <4138A50C.9020905@tallan.com> I have heard it said that it's possible to get a console window to run minimized. I haven't tried it myself but this is probably your best bet. To my knowledge I have not heard of a way to get it not to show up at all. However, noticing that all your doing is running curl instead I'm wondering why you're bothering to run curl at all? Can you not do the same with: import urllib f = open('setup.bat', 'wt') httpf = urllib.urlopen('http://www.example.org?a=user^&b=pass') f.write(httpf.read()) That'd be less overhead than spawning an external program anyway! Lewis Franklin wrote: >My question is probably simple to those who have been programming in >Windows for some time, but I am having a difficult time with a >'simple' problem. > >I have written a program that consists simply of three buttons (using >wxPython). Clicking one of those buttons triggers an event where curl >is executed and the information returned is stored into a file. The >command is simply: > >curl http://www.example.org?a=user^&b=pass -o setup.bat > >I can run this command without any problem. However, the 'problem' >that arises is that while curl is being run a Command Prompt appears. >Since this app is for techno-phobes and can only imagine how much >several windows opening and closing on their own would freak them out, >I am trying to keep the user from seeing this window. I was wondering >if there was a way to run the command without having it open a Command >Prompt. > >I hope that I have been clear enough in stating my question and >situation. Thank you in advance for any assistance you can offer. >Being new to Python on Windows I need help with what may seem a small >task to others. > >Lewis >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From craig at coot.net Fri Sep 3 19:23:44 2004 From: craig at coot.net (Craig H. Anderson) Date: Fri Sep 3 19:23:48 2004 Subject: [python-win32] COM Event Sinks and Connection Points in Python? Message-ID: I would like to work with a COM object that uses the connection point method for event notification. The example code is Visual Basic, but I would prefer to use Python if I can. Google searching found one reference to this not working. http://marc.free.net.ph/message/19990407.090040.ef4c3be4.html Can anyone shed light on this? From fmml at cedval.org Fri Sep 3 19:40:24 2004 From: fmml at cedval.org (fmml@cedval.org) Date: Fri Sep 3 19:40:52 2004 Subject: [python-win32] Simple service... Message-ID: <2352.192.168.41.52.1094233224.squirrel@whoami3.cedval.org> Hi all, I have a script which has a main routine that wakes up every 30 minutes, performs a few things and go back to sleep. I would like to make my script a service. So I wrote a second script that imports modules from the first one. In my code I have the SVCDoRun routine were I run my "my_main()" script main loop and it does work, but can't stop the service from the service manager. Goes like this: def SvcDoRun(self): win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) while 1: my_main() How can I run my script while waiting for the "stop service" signal? Any ideas? Thanks in advance, Francois From theller at python.net Fri Sep 3 19:59:22 2004 From: theller at python.net (Thomas Heller) Date: Fri Sep 3 19:59:38 2004 Subject: [python-win32] Errors (?) in win32con.py Message-ID: I'm currently writing code to parse the windows header files and create Python code from them - see recent articles in the ctypes-users mailing list. When I compare the output of my tools with the contents in win32con.py, I see several differences. One example is the (arbitrarily chosen) CDN_SELCHANGE symbol. In the commdlg.h file I have I see this: #define CDN_FIRST (0U - 601U) ... #define CDN_SELCHANGE (CDN_FIRST - 0x0001) Ignoring signed/unsigned issues (and not showing the FutureWarning from Python 2.3): >>> hex(0 - 601 - 1) '0xfffffda6' >>> import win32con >>> hex(win32con.CDN_SELCHANGE) '0x4efda6' >>> Looking into the win32con.py source code: PY_0U = 5177344 CDN_FIRST = (PY_0U-601) CDN_SELCHANGE = (CDN_FIRST - 1) I'm puzzled. What is PY_0U? hex(5177344) is 0x4F0000, but that doesn't enlighten me. Reading about the CDN_* codes in MSDN, they are used in the NMHDR structure's 'code' field, which is UINT. So the value *is* 32-bit. Thomas From jens.jorgensen at tallan.com Fri Sep 3 20:08:43 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Sep 3 20:08:57 2004 Subject: [python-win32] Simple service... In-Reply-To: <2352.192.168.41.52.1094233224.squirrel@whoami3.cedval.org> References: <2352.192.168.41.52.1094233224.squirrel@whoami3.cedval.org> Message-ID: <4138B32B.2000803@tallan.com> fmml@cedval.org wrote: >Hi all, > >I have a script which has a main routine that wakes up every 30 minutes, >performs a few things and go back to sleep. > >I would like to make my script a service. So I wrote a second script that >imports modules from the first one. > >In my code I have the SVCDoRun routine were I run my "my_main()" script >main loop and it does work, but can't stop the service from the service >manager. > >Goes like this: > >def SvcDoRun(self): > win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) > > while 1: > my_main() > > >How can I run my script while waiting for the "stop service" signal? > > There are a variety of ways. You could run my_main() in another thread: def worker_thread() : while 1 : my_main() def SvcDoRun(self) : thread.start_new_thread(worker_thread, ()) win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) sys.exit(0) but then again if you're just going to do something every 30 minutes and it doesn't take long then why not: def SvcDoRun(self) : thread.start_new_thread(worker_thread, ()) while 1 : retval = win32event.WaitForSingleObject(self.hWaitStop, 30*60*1000) if retval == win32event.WAIT_OBJECT_0 : sys.exit(0) my_main() and take the waiting 30 minutes bit out of my_main? Note: I don't see how your above code would run my_main at all since you're waiting indefinitely for the stop signal, something wrong there. > >Any ideas? > > >Thanks in advance, > >Francois > > > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From pythonmailing at web.de Fri Sep 3 20:51:53 2004 From: pythonmailing at web.de (Marek Kubica) Date: Fri Sep 3 21:06:24 2004 Subject: [python-win32] COM Browser Message-ID: <20040903205153.00000320@galileo> Hello! Do you know any good standalone COM Browser? I was looking in Google, but it only finds the word 'browser' on .com servers (as you can imagene there are missions of these pages). I just found COM Explorer , but is does not show any Functions of the libraries :( greets, Marek From lewis.franklin at gmail.com Fri Sep 3 21:29:30 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Fri Sep 3 21:29:36 2004 Subject: [python-win32] Hidden CLI In-Reply-To: <4138A50C.9020905@tallan.com> References: <80150ed604090219332314493a@mail.gmail.com> <4138A50C.9020905@tallan.com> Message-ID: <80150ed6040903122918d7dc9c@mail.gmail.com> Jens, I like your idea (I'm modifying code that someone else wrote and they apparantly liked curl). However, I was wondering if that works with a secure connection. I'm actually accessing https://www.example.com. I should have put that earlier, but missed the 's'. The information in the module reference was cryptic to me. My apologies to the win32 thread as well, since most of this discussion has in actuality had little to do with Windows API. Lewis On Fri, 03 Sep 2004 12:08:28 -0500, Jens B. Jorgensen wrote: > I have heard it said that it's possible to get a console window to run > minimized. I haven't tried it myself but this is probably your best bet. > To my knowledge I have not heard of a way to get it not to show up at all. > > However, noticing that all your doing is running curl instead I'm > wondering why you're bothering to run curl at all? Can you not do the > same with: > > import urllib > > f = open('setup.bat', 'wt') > httpf = urllib.urlopen('http://www.example.org?a=user^&b=pass') > f.write(httpf.read()) > > That'd be less overhead than spawning an external program anyway! > > > > Lewis Franklin wrote: > > >My question is probably simple to those who have been programming in > >Windows for some time, but I am having a difficult time with a > >'simple' problem. > > > >I have written a program that consists simply of three buttons (using > >wxPython). Clicking one of those buttons triggers an event where curl > >is executed and the information returned is stored into a file. The > >command is simply: > > > >curl http://www.example.org?a=user^&b=pass -o setup.bat > > > >I can run this command without any problem. However, the 'problem' > >that arises is that while curl is being run a Command Prompt appears. > >Since this app is for techno-phobes and can only imagine how much > >several windows opening and closing on their own would freak them out, > >I am trying to keep the user from seeing this window. I was wondering > >if there was a way to run the command without having it open a Command > >Prompt. > > > >I hope that I have been clear enough in stating my question and > >situation. Thank you in advance for any assistance you can offer. > >Being new to Python on Windows I need help with what may seem a small > >task to others. > > > >Lewis > >_______________________________________________ > >Python-win32 mailing list > >Python-win32@python.org > >http://mail.python.org/mailman/listinfo/python-win32 > > > > > > -- > Jens B. Jorgensen > jens.jorgensen@tallan.com > > "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" > > From theller at python.net Fri Sep 3 21:34:27 2004 From: theller at python.net (Thomas Heller) Date: Fri Sep 3 21:34:42 2004 Subject: [python-win32] Re: COM Browser References: <20040903205153.00000320@galileo> Message-ID: <7jrbb0zg.fsf@python.net> Marek Kubica writes: > Hello! > Do you know any good standalone COM Browser? I was looking in Google, > but it only finds the word 'browser' on .com servers (as you can imagene > there are missions of these pages). > I just found COM Explorer , but is does not show any Functions of the > libraries :( > > greets, > Marek oleview? Thomas From jens.jorgensen at tallan.com Fri Sep 3 21:49:07 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Sep 3 21:49:40 2004 Subject: [python-win32] COM Browser In-Reply-To: <20040903205153.00000320@galileo> References: <20040903205153.00000320@galileo> Message-ID: <4138CAB3.7030303@tallan.com> I'm not sure what you're after but it sounds like the utility you want is a Type Library browser. If so then what you're after is oleview. This tools comes as a standard part of microsoft developer studio. I don't know if you can get it outside of that. Marek Kubica wrote: >Hello! >Do you know any good standalone COM Browser? I was looking in Google, >but it only finds the word 'browser' on .com servers (as you can imagene >there are missions of these pages). >I just found COM Explorer , but is does not show any Functions of the >libraries :( > >greets, >Marek > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2861 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040903/23ab4af5/smime.bin From timr at probo.com Fri Sep 3 23:20:08 2004 From: timr at probo.com (Tim Roberts) Date: Fri Sep 3 23:14:35 2004 Subject: [python-win32] Errors (?) in win32con.py In-Reply-To: <20040903192936.9F5D11E400E@bag.python.org> References: <20040903192936.9F5D11E400E@bag.python.org> Message-ID: <4138E008.5060006@probo.com> On Fri, 03 Sep 2004 19:59:22 +0200, Thomas Heller wrote: > I'm currently writing code to parse the windows header files and > create Python code from them - see recent articles in the ctypes-users > mailing list. When I compare the output of my tools with the contents > in win32con.py, I see several differences. One example is the > (arbitrarily chosen) CDN_SELCHANGE symbol. In the commdlg.h file I > have I see this: #define CDN_FIRST (0U - 601U) ... #define > CDN_SELCHANGE (CDN_FIRST - 0x0001) Ignoring signed/unsigned issues > (and not showing the FutureWarning from Python 2.3): > >>>>>>> hex(0 - 601 - 1) >>>> >>>> >'0xfffffda6' > > >>>>>>> import win32con >>>>>>> hex(win32con.CDN_SELCHANGE) >>>> >>>> >'0x4efda6' > > >>>>>>> >>>> >>>> > >Looking into the win32con.py source code: > >PY_0U = 5177344 >CDN_FIRST = (PY_0U-601) >CDN_SELCHANGE = (CDN_FIRST - 1) > >I'm puzzled. What is PY_0U? > > Interesting; I would call that a bug. It's clearly an attempt to render the C unsigned constant 0U into Python, but you are correct: the resulting values are not the same. CDN_FIRST should be -601, which is FFFFFDA7, not 004FDA7. Unfortunately, playing with this stuff runs into the new FutureWarnings. I would have guessed that PY_0U = 0x10000000L would produce the best overall results. -- - Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc. From lbates at syscononline.com Fri Sep 3 23:14:49 2004 From: lbates at syscononline.com (Larry Bates) Date: Fri Sep 3 23:14:55 2004 Subject: [python-win32] Simple service... In-Reply-To: <20040903192936.9F5D11E400E@bag.python.org> Message-ID: <006801c491fb$0c4258b0$5d00a8c0@LABWXP> You must check to see if stop signal has been received inside your loop. You should set a timeout (not INFINITE). def SvcDoRun(self): self.timeout=30*60*1000 # Sleep for 30 minutes between runs while 1: #--------------------------------------------------------------------- # Wait for service stop signal, if I timeout, loop again #--------------------------------------------------------------------- rc=win32event.WaitForSingleObject(self.hWaitStop, self.timeout) # # Check to see if self.hWaitStop happened # if rc == win32event.WAIT_OBJECT_0: # # Stop signal encountered # break my_main() and have a SvcStop method: def SvcStop(self): #--------------------------------------------------------------------- # Before we do anything, tell SCM we are starting the stop process. #--------------------------------------------------------------------- self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) #--------------------------------------------------------------------- # And set my event #--------------------------------------------------------------------- win32event.SetEvent(self.hWaitStop) return This runs my_main. When my_main returns, it goes to sleep for 30 minutes and then it runs again (unless stop signal is received). HTH, Larry Bates Syscon, Inc. Message: 5 Date: Fri, 3 Sep 2004 13:40:24 -0400 (EDT) From: fmml@cedval.org Subject: [python-win32] Simple service... To: python-win32@python.org Message-ID: <2352.192.168.41.52.1094233224.squirrel@whoami3.cedval.org> Content-Type: text/plain;charset=iso-8859-1 Hi all, I have a script which has a main routine that wakes up every 30 minutes, performs a few things and go back to sleep. I would like to make my script a service. So I wrote a second script that imports modules from the first one. In my code I have the SVCDoRun routine were I run my "my_main()" script main loop and it does work, but can't stop the service from the service manager. Goes like this: def SvcDoRun(self): win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) while 1: my_main() How can I run my script while waiting for the "stop service" signal? Any ideas? Thanks in advance, Francois ------------------------------ Message: 6 Date: Fri, 03 Sep 2004 19:59:22 +0200 From: Thomas Heller Subject: [python-win32] Errors (?) in win32con.py To: python-win32@python.org Message-ID: Content-Type: text/plain; charset=us-ascii I'm currently writing code to parse the windows header files and create Python code from them - see recent articles in the ctypes-users mailing list. When I compare the output of my tools with the contents in win32con.py, I see several differences. One example is the (arbitrarily chosen) CDN_SELCHANGE symbol. In the commdlg.h file I have I see this: #define CDN_FIRST (0U - 601U) ... #define CDN_SELCHANGE (CDN_FIRST - 0x0001) Ignoring signed/unsigned issues (and not showing the FutureWarning from Python 2.3): >>> hex(0 - 601 - 1) '0xfffffda6' >>> import win32con >>> hex(win32con.CDN_SELCHANGE) '0x4efda6' >>> Looking into the win32con.py source code: PY_0U = 5177344 CDN_FIRST = (PY_0U-601) CDN_SELCHANGE = (CDN_FIRST - 1) I'm puzzled. What is PY_0U? hex(5177344) is 0x4F0000, but that doesn't enlighten me. Reading about the CDN_* codes in MSDN, they are used in the NMHDR structure's 'code' field, which is UINT. So the value *is* 32-bit. Thomas ------------------------------ Message: 7 Date: Fri, 03 Sep 2004 13:08:43 -0500 From: "Jens B. Jorgensen" Subject: Re: [python-win32] Simple service... To: fmml@cedval.org Cc: python-win32@python.org Message-ID: <4138B32B.2000803@tallan.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed fmml@cedval.org wrote: >Hi all, > >I have a script which has a main routine that wakes up every 30 minutes, >performs a few things and go back to sleep. > >I would like to make my script a service. So I wrote a second script that >imports modules from the first one. > >In my code I have the SVCDoRun routine were I run my "my_main()" script >main loop and it does work, but can't stop the service from the service >manager. > >Goes like this: > >def SvcDoRun(self): > win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) > > while 1: > my_main() > > >How can I run my script while waiting for the "stop service" signal? > > There are a variety of ways. You could run my_main() in another thread: def worker_thread() : while 1 : my_main() def SvcDoRun(self) : thread.start_new_thread(worker_thread, ()) win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) sys.exit(0) but then again if you're just going to do something every 30 minutes and it doesn't take long then why not: def SvcDoRun(self) : thread.start_new_thread(worker_thread, ()) while 1 : retval = win32event.WaitForSingleObject(self.hWaitStop, 30*60*1000) if retval == win32event.WAIT_OBJECT_0 : sys.exit(0) my_main() and take the waiting 30 minutes bit out of my_main? Note: I don't see how your above code would run my_main at all since you're waiting indefinitely for the stop signal, something wrong there. > >Any ideas? > > >Thanks in advance, > >Francois > > > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" ------------------------------ Message: 8 Date: Fri, 3 Sep 2004 20:51:53 +0200 From: Marek Kubica Subject: [python-win32] COM Browser To: Python-win32 mailinglist Message-ID: <20040903205153.00000320@galileo> Content-Type: text/plain; charset=US-ASCII Hello! Do you know any good standalone COM Browser? I was looking in Google, but it only finds the word 'browser' on .com servers (as you can imagene there are missions of these pages). I just found COM Explorer , but is does not show any Functions of the libraries :( greets, Marek ------------------------------ Message: 9 Date: Fri, 3 Sep 2004 14:29:30 -0500 From: Lewis Franklin Subject: Re: [python-win32] Hidden CLI To: "Jens B. Jorgensen" Cc: python-win32@python.org Message-ID: <80150ed6040903122918d7dc9c@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII Jens, I like your idea (I'm modifying code that someone else wrote and they apparantly liked curl). However, I was wondering if that works with a secure connection. I'm actually accessing https://www.example.com. I should have put that earlier, but missed the 's'. The information in the module reference was cryptic to me. My apologies to the win32 thread as well, since most of this discussion has in actuality had little to do with Windows API. Lewis On Fri, 03 Sep 2004 12:08:28 -0500, Jens B. Jorgensen wrote: > I have heard it said that it's possible to get a console window to run > minimized. I haven't tried it myself but this is probably your best bet. > To my knowledge I have not heard of a way to get it not to show up at all. > > However, noticing that all your doing is running curl instead I'm > wondering why you're bothering to run curl at all? Can you not do the > same with: > > import urllib > > f = open('setup.bat', 'wt') > httpf = urllib.urlopen('http://www.example.org?a=user^&b=pass') > f.write(httpf.read()) > > That'd be less overhead than spawning an external program anyway! > > > > Lewis Franklin wrote: > > >My question is probably simple to those who have been programming in > >Windows for some time, but I am having a difficult time with a > >'simple' problem. > > > >I have written a program that consists simply of three buttons (using > >wxPython). Clicking one of those buttons triggers an event where curl > >is executed and the information returned is stored into a file. The > >command is simply: > > > >curl http://www.example.org?a=user^&b=pass -o setup.bat > > > >I can run this command without any problem. However, the 'problem' > >that arises is that while curl is being run a Command Prompt appears. > >Since this app is for techno-phobes and can only imagine how much > >several windows opening and closing on their own would freak them out, > >I am trying to keep the user from seeing this window. I was wondering > >if there was a way to run the command without having it open a Command > >Prompt. > > > >I hope that I have been clear enough in stating my question and > >situation. Thank you in advance for any assistance you can offer. > >Being new to Python on Windows I need help with what may seem a small > >task to others. > > > >Lewis > >_______________________________________________ > >Python-win32 mailing list > >Python-win32@python.org > >http://mail.python.org/mailman/listinfo/python-win32 > > > > > > -- > Jens B. Jorgensen > jens.jorgensen@tallan.com > > "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" > > ------------------------------ _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 End of Python-win32 Digest, Vol 18, Issue 4 ******************************************* From jens.jorgensen at tallan.com Fri Sep 3 23:21:34 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Sep 3 23:21:47 2004 Subject: [python-win32] Hidden CLI In-Reply-To: <80150ed6040903122918d7dc9c@mail.gmail.com> References: <80150ed604090219332314493a@mail.gmail.com> <4138A50C.9020905@tallan.com> <80150ed6040903122918d7dc9c@mail.gmail.com> Message-ID: <4138E05E.9040005@tallan.com> Lewis Franklin wrote: >Jens, > >I like your idea (I'm modifying code that someone else wrote and they >apparantly liked curl). However, I was wondering if that works with a >secure connection. I'm actually accessing https://www.example.com. I >should have put that earlier, but missed the 's'. The information in >the module reference was cryptic to me. > > I like curl too! But it certainly is nice not to get extra weird windows popping up eh? Yes, it should work just fine for a secure connection. I just tried that on my python installation and it worked like a charm. >My apologies to the win32 thread as well, since most of this >discussion has in actuality had little to do with Windows API. > > True, but this one was an easy one. >Lewis > > >On Fri, 03 Sep 2004 12:08:28 -0500, Jens B. Jorgensen > wrote: > > >>I have heard it said that it's possible to get a console window to run >>minimized. I haven't tried it myself but this is probably your best bet. >>To my knowledge I have not heard of a way to get it not to show up at all. >> >>However, noticing that all your doing is running curl instead I'm >>wondering why you're bothering to run curl at all? Can you not do the >>same with: >> >>import urllib >> >>f = open('setup.bat', 'wt') >>httpf = urllib.urlopen('http://www.example.org?a=user^&b=pass') >>f.write(httpf.read()) >> >>That'd be less overhead than spawning an external program anyway! >> >> >> >>Lewis Franklin wrote: >> >> >> >>>My question is probably simple to those who have been programming in >>>Windows for some time, but I am having a difficult time with a >>>'simple' problem. >>> >>>I have written a program that consists simply of three buttons (using >>>wxPython). Clicking one of those buttons triggers an event where curl >>>is executed and the information returned is stored into a file. The >>>command is simply: >>> >>>curl http://www.example.org?a=user^&b=pass -o setup.bat >>> >>>I can run this command without any problem. However, the 'problem' >>>that arises is that while curl is being run a Command Prompt appears. >>>Since this app is for techno-phobes and can only imagine how much >>>several windows opening and closing on their own would freak them out, >>>I am trying to keep the user from seeing this window. I was wondering >>>if there was a way to run the command without having it open a Command >>>Prompt. >>> >>>I hope that I have been clear enough in stating my question and >>>situation. Thank you in advance for any assistance you can offer. >>>Being new to Python on Windows I need help with what may seem a small >>>task to others. >>> >>>Lewis >>>_______________________________________________ >>>Python-win32 mailing list >>>Python-win32@python.org >>>http://mail.python.org/mailman/listinfo/python-win32 >>> >>> >>> >>> >>-- >>Jens B. Jorgensen >>jens.jorgensen@tallan.com >> >>"With a focused commitment to our clients and our people, we deliver value through customized technology solutions" >> >> >> >> -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From pythonmailing at web.de Fri Sep 3 22:39:08 2004 From: pythonmailing at web.de (Marek Kubica) Date: Sat Sep 4 13:37:59 2004 Subject: [python-win32] COM Browser In-Reply-To: <4138CAB3.7030303@tallan.com> References: <20040903205153.00000320@galileo> <4138CAB3.7030303@tallan.com> Message-ID: <20040903223908.00001441@galileo> On Fri, 03 Sep 2004 14:49:07 -0500 "Jens B. Jorgensen" wrote: > I'm not sure what you're after but it sounds like the utility you want > is a Type Library browser. If so then what you're after is oleview. > This tools comes as a standard part of microsoft developer studio. I > don't know if you can get it outside of that. Yes, it is: http://www.microsoft.com/com/resources/oleview.asp Well, it seems to be quite good. Thanks! greets, Marek From pythonmailing at web.de Fri Sep 3 23:03:16 2004 From: pythonmailing at web.de (Marek Kubica) Date: Sat Sep 4 13:37:59 2004 Subject: [python-win32] How to get the Dispatch string? Message-ID: <20040903230316.000051ee@galileo> Hallo again! I'm wondering how to get the string needed for win32com.client.Dispatch(). Well, for example, I want to Dispatch "MozillaControl 1.0 Type Library" so where I have to search? I just know that Word is "Word.Application", but I looked in the pywin32 docs. greets, Marek From fmml at cedval.org Sat Sep 4 19:02:31 2004 From: fmml at cedval.org (fmml@cedval.org) Date: Sat Sep 4 19:02:58 2004 Subject: [python-win32] Simple service... In-Reply-To: <006801c491fb$0c4258b0$5d00a8c0@LABWXP> References: <20040903192936.9F5D11E400E@bag.python.org> <006801c491fb$0c4258b0$5d00a8c0@LABWXP> Message-ID: <3599.192.168.41.191.1094317351.squirrel@whoami3.cedval.org> Hi all, Wonderfull, works like a charm, did also tests with Jens's recipe. Thanks all for the help, Have a nice week-end, Francois > You must check to see if stop signal has been received > inside your loop. You should set a timeout (not INFINITE). > > > def SvcDoRun(self): > self.timeout=30*60*1000 # Sleep for 30 minutes between runs > while 1: > #--------------------------------------------------------------------- > # Wait for service stop signal, if I timeout, loop again > #--------------------------------------------------------------------- > rc=win32event.WaitForSingleObject(self.hWaitStop, self.timeout) > # > # Check to see if self.hWaitStop happened > # > if rc == win32event.WAIT_OBJECT_0: > # > # Stop signal encountered > # > break > > my_main() > > > and have a SvcStop method: > > def SvcStop(self): > #--------------------------------------------------------------------- > # Before we do anything, tell SCM we are starting the stop > process. > #--------------------------------------------------------------------- > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > #--------------------------------------------------------------------- > # And set my event > #--------------------------------------------------------------------- > win32event.SetEvent(self.hWaitStop) > return > > > This runs my_main. When my_main returns, it goes to sleep for 30 minutes > and > then it runs again (unless stop signal is received). > > HTH, > Larry Bates > Syscon, Inc. > > > Message: 5 > Date: Fri, 3 Sep 2004 13:40:24 -0400 (EDT) > From: fmml@cedval.org > Subject: [python-win32] Simple service... > To: python-win32@python.org > Message-ID: > <2352.192.168.41.52.1094233224.squirrel@whoami3.cedval.org> > Content-Type: text/plain;charset=iso-8859-1 > > Hi all, > > I have a script which has a main routine that wakes up every 30 minutes, > performs a few things and go back to sleep. > > I would like to make my script a service. So I wrote a second script that > imports modules from the first one. > > In my code I have the SVCDoRun routine were I run my "my_main()" script > main loop and it does work, but can't stop the service from the service > manager. > > Goes like this: > > def SvcDoRun(self): > win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) > > while 1: > my_main() > > > How can I run my script while waiting for the "stop service" signal? > > > Any ideas? > > > Thanks in advance, > > Francois > > > > > > > ------------------------------ > > Message: 6 > Date: Fri, 03 Sep 2004 19:59:22 +0200 > From: Thomas Heller > Subject: [python-win32] Errors (?) in win32con.py > To: python-win32@python.org > Message-ID: > Content-Type: text/plain; charset=us-ascii > > I'm currently writing code to parse the windows header files and create > Python code from them - see recent articles in the ctypes-users mailing > list. > > When I compare the output of my tools with the contents in win32con.py, > I see several differences. > One example is the (arbitrarily chosen) CDN_SELCHANGE symbol. > > In the commdlg.h file I have I see this: > > #define CDN_FIRST (0U - 601U) > ... > #define CDN_SELCHANGE (CDN_FIRST - 0x0001) > > Ignoring signed/unsigned issues (and not showing the FutureWarning from > Python 2.3): >>>> hex(0 - 601 - 1) > '0xfffffda6' >>>> import win32con >>>> hex(win32con.CDN_SELCHANGE) > '0x4efda6' >>>> > > Looking into the win32con.py source code: > > PY_0U = 5177344 > CDN_FIRST = (PY_0U-601) > CDN_SELCHANGE = (CDN_FIRST - 1) > > I'm puzzled. What is PY_0U? > > hex(5177344) is 0x4F0000, but that doesn't enlighten me. > > Reading about the CDN_* codes in MSDN, they are used in the NMHDR > structure's 'code' field, which is UINT. So the value *is* 32-bit. > > Thomas > > > > ------------------------------ > > Message: 7 > Date: Fri, 03 Sep 2004 13:08:43 -0500 > From: "Jens B. Jorgensen" > Subject: Re: [python-win32] Simple service... > To: fmml@cedval.org > Cc: python-win32@python.org > Message-ID: <4138B32B.2000803@tallan.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > fmml@cedval.org wrote: > >>Hi all, >> >>I have a script which has a main routine that wakes up every 30 minutes, >>performs a few things and go back to sleep. >> >>I would like to make my script a service. So I wrote a second script that >>imports modules from the first one. >> >>In my code I have the SVCDoRun routine were I run my "my_main()" script >>main loop and it does work, but can't stop the service from the service >>manager. >> >>Goes like this: >> >>def SvcDoRun(self): >> win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) >> >> while 1: >> my_main() >> >> >>How can I run my script while waiting for the "stop service" signal? >> >> > There are a variety of ways. You could run my_main() in another thread: > > def worker_thread() : > while 1 : > my_main() > > def SvcDoRun(self) : > thread.start_new_thread(worker_thread, ()) > > win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) > sys.exit(0) > > but then again if you're just going to do something every 30 minutes and > it doesn't take long then why not: > > def SvcDoRun(self) : > thread.start_new_thread(worker_thread, ()) > > while 1 : > retval = win32event.WaitForSingleObject(self.hWaitStop, > 30*60*1000) > if retval == win32event.WAIT_OBJECT_0 : > sys.exit(0) > my_main() > > and take the waiting 30 minutes bit out of my_main? > > Note: I don't see how your above code would run my_main at all since > you're waiting indefinitely for the stop signal, something wrong there. > >> >>Any ideas? >> >> >>Thanks in advance, >> >>Francois >> >> >> >> >>_______________________________________________ >>Python-win32 mailing list >>Python-win32@python.org >>http://mail.python.org/mailman/listinfo/python-win32 >> >> > > > -- > Jens B. Jorgensen > jens.jorgensen@tallan.com > > "With a focused commitment to our clients and our people, we deliver value > through customized technology solutions" > > > > ------------------------------ > > Message: 8 > Date: Fri, 3 Sep 2004 20:51:53 +0200 > From: Marek Kubica > Subject: [python-win32] COM Browser > To: Python-win32 mailinglist > Message-ID: <20040903205153.00000320@galileo> > Content-Type: text/plain; charset=US-ASCII > > Hello! > Do you know any good standalone COM Browser? I was looking in Google, > but it only finds the word 'browser' on .com servers (as you can imagene > there are missions of these pages). > I just found COM Explorer , but is does not show any Functions of the > libraries :( > > greets, > Marek > > > > ------------------------------ > > Message: 9 > Date: Fri, 3 Sep 2004 14:29:30 -0500 > From: Lewis Franklin > Subject: Re: [python-win32] Hidden CLI > To: "Jens B. Jorgensen" > Cc: python-win32@python.org > Message-ID: <80150ed6040903122918d7dc9c@mail.gmail.com> > Content-Type: text/plain; charset=US-ASCII > > Jens, > > I like your idea (I'm modifying code that someone else wrote and they > apparantly liked curl). However, I was wondering if that works with a > secure connection. I'm actually accessing https://www.example.com. I > should have put that earlier, but missed the 's'. The information in > the module reference was cryptic to me. > > My apologies to the win32 thread as well, since most of this > discussion has in actuality had little to do with Windows API. > > Lewis > > > On Fri, 03 Sep 2004 12:08:28 -0500, Jens B. Jorgensen > wrote: >> I have heard it said that it's possible to get a console window to run >> minimized. I haven't tried it myself but this is probably your best bet. >> To my knowledge I have not heard of a way to get it not to show up at >> all. >> >> However, noticing that all your doing is running curl instead I'm >> wondering why you're bothering to run curl at all? Can you not do the >> same with: >> >> import urllib >> >> f = open('setup.bat', 'wt') >> httpf = urllib.urlopen('http://www.example.org?a=user^&b=pass') >> f.write(httpf.read()) >> >> That'd be less overh > ead than spawning an external program anyway! >> >> >> >> Lewis Franklin wrote: >> >> >My question is probably simple to those who have been programming in >> >Windows for some time, but I am having a difficult time with a >> >'simple' problem. >> > >> >I have written a program that consists simply of three buttons (using >> >wxPython). Clicking one of those buttons triggers an event where curl >> >is executed and the information returned is stored into a file. The >> >command is simply: >> > >> >curl http://www.example.org?a=user^&b=pass -o setup.bat >> > >> >I can run this command without any problem. However, the 'problem' >> >that arises is that while curl is being run a Command Prompt appears. >> >Since this app is for techno-phobes and can only imagine how much >> >several windows opening and closing on their own would freak them out, >> >I am trying to keep the user from seeing this window. I was wondering >> >if there was a way to run the command without having it open a Command >> >Prompt. >> > >> >I hope that I have been clear enough in stating my question and >> >situation. Thank you in advance for any assistance you can offer. >> >Being new to Python on Windows I need help with what may seem a small >> >task to others. >> > >> >Lewis >> >_______________________________________________ >> >Python-win32 mailing list >> >Python-win32@python.org >> >http://mail.python.org/mailman/listinfo/python-win32 >> > >> > >> >> -- >> Jens B. Jorgensen >> jens.jorgensen@tallan.com >> >> "With a focused commitment to our clients and our people, we deliver >> value > through customized technology solutions" >> >> > > > ------------------------------ > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > End of Python-win32 Digest, Vol 18, Issue 4 > From apocalypznow at yahoo.com Sun Sep 5 12:11:08 2004 From: apocalypznow at yahoo.com (apocalypznow) Date: Sun Sep 5 12:10:15 2004 Subject: [python-win32] Automation server returns BSTR, but Python client gets unicode error. Message-ID: Hi, I implemented an automation server, and a python client that calls it. One of the automation server methods returns a VARIANT, which the python client is supposed to interpret as a string. I get a unicode error from the call to the automation server method as follows: s = automationserver.SendMessage("Hello Automationserver") TypeError: 'unicode' object not callable The automation server method in question is as follows: VARIANT CTestmfcautomationserverDlgAutoProxy::SendMessage(const VARIANT FAR& param1) { VARIANT vaResult; VariantInit(&vaResult); AfxMessageBox(_T("SendMessage is hit!")); vaResult.vt = VT_BSTR; CComBSTR bstr(""); BSTR txt = bstr.Detach(); vaResult.bstrVal = txt; return vaResult; } The relevant part of the odl (idl) file definition is as follows: dispinterface ITestmfcautomationserver { properties: methods: [id(1)] VARIANT SendMessage(VARIANT param1); }; How do I fix this? From mhammond at skippinet.com.au Mon Sep 6 00:13:43 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Sep 6 00:13:13 2004 Subject: [python-win32] COM Event Sinks and Connection Points in Python? In-Reply-To: Message-ID: <088e01c49395$9be542c0$0200a8c0@eden> > I would like to work with a COM object that uses the connection point > method for event notification. The example code is Visual Basic, > but I would prefer to use Python if I can. Google searching found one > reference to this not working. > > http://marc.free.net.ph/message/19990407.090040.ef4c3be4.html Look at the "win32com.client.DispatchWithEvents" docstring, or look at, eg, win32com\test\testMFOfficeEvents Mark From mhammond at skippinet.com.au Mon Sep 6 02:34:28 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Sep 6 02:34:03 2004 Subject: [python-win32] Errors (?) in win32con.py In-Reply-To: <4138E008.5060006@probo.com> Message-ID: <08bd01c493a9$4790e210$0200a8c0@eden> Thomas: > >Looking into the win32con.py source code: > > > >PY_0U = 5177344 > >CDN_FIRST = (PY_0U-601) > >CDN_SELCHANGE = (CDN_FIRST - 1) > > > >I'm puzzled. What is PY_0U? > > > > > > Interesting; I would call that a bug. It's clearly an > attempt to render > the C unsigned constant 0U into Python, but you are correct: the > resulting values are not the same. CDN_FIRST should be -601, > which is > FFFFFDA7, not 004FDA7. Yeah, I think that is correct. I've no idea where PY_0U came from - quite possibly a very old h2py used way back when it was created. > Unfortunately, playing with this stuff runs into the new > FutureWarnings. I would have guessed that > PY_0U = 0x10000000L > would produce the best overall results. I'm not too happy promoting all these constants to longs just to prevent that warning. These constants are 32 bit values used by the API rather than "numbers", so I took the approach of using their base 10 representation rather than using hex constants. I think this whole int/long unification is a bit of a mess for people who actually *want* to use machine ints. I hope keeping my head in the sand that way doesn't expose my behind to being bitten later :) So for now, I think setting PY_OU = 0 is the most consistent thing. Mark. From theller at python.net Mon Sep 6 10:26:56 2004 From: theller at python.net (Thomas Heller) Date: Mon Sep 6 10:26:59 2004 Subject: [python-win32] Re: Errors (?) in win32con.py References: <4138E008.5060006@probo.com> <08bd01c493a9$4790e210$0200a8c0@eden> Message-ID: <656rol9r.fsf@python.net> "Mark Hammond" writes: > Thomas: >> >Looking into the win32con.py source code: >> > >> >PY_0U = 5177344 >> >CDN_FIRST = (PY_0U-601) >> >CDN_SELCHANGE = (CDN_FIRST - 1) >> > >> >I'm puzzled. What is PY_0U? >> > >> > >> >> Interesting; I would call that a bug. It's clearly an >> attempt to render >> the C unsigned constant 0U into Python, but you are correct: the >> resulting values are not the same. CDN_FIRST should be -601, >> which is >> FFFFFDA7, not 004FDA7. > > Yeah, I think that is correct. I've no idea where PY_0U came from - quite > possibly a very old h2py used way back when it was created. > >> Unfortunately, playing with this stuff runs into the new >> FutureWarnings. I would have guessed that >> PY_0U = 0x10000000L >> would produce the best overall results. > > I'm not too happy promoting all these constants to longs just to prevent > that warning. These constants are 32 bit values used by the API rather than > "numbers", so I took the approach of using their base 10 representation > rather than using hex constants. I think this whole int/long unification is > a bit of a mess for people who actually *want* to use machine ints. > I hope keeping my head in the sand that way doesn't expose my behind > to being bitten later :) > So for now, I think setting PY_OU = 0 is the most consistent thing. I'm currently working on a better replacement for h2py. A Python script generates a c++ program, which uses overloaded functions, which in turn generates a Python module. Hehe - my first, actually useful c++ program. This one """ #include #include #include "dumph.h" int main() { DUMP(CHAR_BIT); DUMP(SCHAR_MIN); DUMP(SCHAR_MAX); DUMP(UCHAR_MAX); DUMP(CHAR_MIN); DUMP(CHAR_MAX); DUMP(SHRT_MIN); DUMP(SHRT_MAX); DUMP(USHRT_MAX); DUMP(INT_MIN); DUMP(INT_MAX); DUMP(UINT_MAX); DUMP(LONG_MIN); DUMP(LONG_MAX); DUMP(ULONG_MAX); DUMP(_I8_MIN); DUMP(_I8_MAX); DUMP(_UI8_MAX); DUMP(_I16_MIN); DUMP(_I16_MAX); DUMP(_UI16_MAX); DUMP(_I32_MIN); DUMP(_I32_MAX); DUMP(_UI32_MAX); DUMP(_I64_MIN); DUMP(_I64_MAX); DUMP(_UI64_MAX); DUMP(MB_OK); DUMP(CDN_SELCHANGE); DUMP(RICHEDIT_CLASS); DUMP(RICHEDIT_CLASSA); DUMP(RICHEDIT_CLASSW); return 0; } """ prints this, which seems to work correctly both in Python 2.3 and 2.4: """ CHAR_BIT = 8 SCHAR_MIN = -128 SCHAR_MAX = 127 UCHAR_MAX = 255 CHAR_MIN = -128 CHAR_MAX = 127 SHRT_MIN = -32768 SHRT_MAX = 32767 USHRT_MAX = 65535 INT_MIN = -2147483648 INT_MAX = 2147483647 UINT_MAX = 4294967295 LONG_MIN = -2147483648 LONG_MAX = 2147483647 ULONG_MAX = 4294967295 _I8_MIN = -128 _I8_MAX = 127 _UI8_MAX = 255 _I16_MIN = -32768 _I16_MAX = 32767 _UI16_MAX = 65535 _I32_MIN = -2147483648 _I32_MAX = 2147483647 _UI32_MAX = 4294967295 _I64_MIN = -9223372036854775808 _I64_MAX = 9223372036854775807 _UI64_MAX = 18446744073709551615 MB_OK = 0 CDN_SELCHANGE = 4294966694 RICHEDIT_CLASS = "RichEdit20A" RICHEDIT_CLASSA = "RichEdit20A" RICHEDIT_CLASSW = u"RichEdit20W" """ Maybe this program can then be used to recreate win32con.py. Thomas From Ian.Dickinson at littlewoodsgaming.com Mon Sep 6 13:51:58 2004 From: Ian.Dickinson at littlewoodsgaming.com (Ian Dickinson) Date: Mon Sep 6 13:52:58 2004 Subject: [python-win32] Communicating with a midi device using python and Windows 2000 Message-ID: HI I have now successfully subscribed to the mailing list I am interested in communicating with a midi device using python and Windows 2000 I am fairly familiar with Python and pygame, but not with windows development My aim is to write a config tool and midi sequencer in python The device that i need to comunicate with is compactable with standard windows midi callls (so the manufacturer tells me, but could or would not explain to me how I accessed the device using them) I have done a bit of investigation and was wondering if I could access the windows API mciSendString from python. I would be very grateful for any help with this problem or point me in the right direction Thanks in advance Ian ......................................................................... .................................................... CHANGE OF EMAIL ADDRESS Please be aware that all emails sent to Littlewoods-Leisure.com should now be sent to firstname.secondname@littlewoodsgaming.com. Please update your records accordingly. CONFIDENTIALITY NOTICE This e-mail and any files transmitted with it are confidential and may be privileged. It is intended solely for the use of the individual or entity to which it is addressed and any unauthorised use or disclosure is prohibited and may be unlawful. If you have received this e-mail in error you should not copy or use it for any purpose or disclose its contents to any person. You should return the e-mail and any attachments to the sender. VIRUSES This e-mail message has been swept by a program for the presence of computer viruses. The contents of any attachment may contain software viruses which could damage your own computer. While Littlewoods Gaming has taken reasonable precautions to minimise the risk of software viruses,it cannot accept liability for any damage which you may suffer as a result of such viruses. We recommend that you carry out your own virus checks before opening any attachment. ........................................................................ ..................................................... From apocalypznow at yahoo.com Tue Sep 7 01:37:08 2004 From: apocalypznow at yahoo.com (apocalypznow) Date: Tue Sep 7 01:30:22 2004 Subject: [python-win32] DispatchWithEvents Message-ID: On the server side of DispatchWithEvents, does the VC++ code that implements an automation server must also implement connectionpoints for DispatchWithEvents? In other words, DispatchWithEvents is expecting connectionpoints on the server? Or is there some other event mechanism? From mhammond at skippinet.com.au Tue Sep 7 01:45:15 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 7 01:44:46 2004 Subject: [python-win32] DispatchWithEvents In-Reply-To: Message-ID: <02ac01c4946b$8fe5f380$0200a8c0@eden> > On the server side of DispatchWithEvents, does the VC++ code that > implements an automation server must also implement > connectionpoints for > DispatchWithEvents? > > In other words, DispatchWithEvents is expecting > connectionpoints on the > server? Or is there some other event mechanism? It uses connection-points. Check out the __init__ code in classes generated by makepy for event classes: import win32com.server.util from win32com.server.policy import EventHandlerPolicy cpc=oobj._oleobj_.QueryInterface(pythoncom.IID_IConnectionPointContainer) cp=cpc.FindConnectionPoint(self.CLSID_Sink) cookie=cp.Advise(win32com.server.util.wrap(self, usePolicy=EventHandlerPolicy)) self._olecp,self._olecp_cookie = cp,cookie This is just a fairly standard connection-point dance, but with a few things to trick the pythoncom framework into doing the right thing. Mark. From apocalypznow at yahoo.com Tue Sep 7 03:16:51 2004 From: apocalypznow at yahoo.com (apocalypznow) Date: Tue Sep 7 03:10:03 2004 Subject: [python-win32] 'NoneType' object is not callable Message-ID: I always get this error when calling a function on the automation server: 'NoneType' object is not callable Then the python program stops executing. In the code below, mfcserver.SendMessage1() gives the error, and the print "Finished" line never executes. It looks as though the dispatch is happening dynamically. The error happens even if gencache is not used. Code: from win32com.client import gencache gencache.EnsureModule('{6CAC46EE-C71C-475C-B372-2E988DA78678x0x1x0}', 0, 1, 0) mfcserver = win32com.client.Dispatch("Testmfcserver.Application") mfcserver.SendMessage1("Hello server.") print "Finished" From mhammond at skippinet.com.au Tue Sep 7 05:10:32 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 7 05:10:01 2004 Subject: [python-win32] 'NoneType' object is not callable In-Reply-To: Message-ID: <02d401c49488$3d4a5040$0200a8c0@eden> > I always get this error when calling a function on the automation > server: 'NoneType' object is not callable > Then the python program stops executing. In the code below, > mfcserver.SendMessage1() gives the error, and the print > "Finished" line > never executes. Your COM server is reponding to a request for a *property* named "SendMessage1", and returning None. Python it then attempting to call it. You should raise DIS_E_MEMBERNOTFOUND when it is requested as a property. You can worm around that using: ob._FlagAsMethod("SendMessage1") before trying to make the call. > It looks as though the dispatch is happening dynamically. The error > happens even if gencache is not used. That means your object is not responding to GetTypeInfo() - so python has no clue what type lib info to use. You should be able to worm around that by: mod = gencache.EnsureModule('{6CAC46EE-C71C-475C-B372-2E988DA78678x0x1x0}', 0, 1, 0) mfcserver = win32com.client.Dispatch("Testmfcserver.Application") mfcserver = mod.Application(mfcserver) mfcserver.SendMessage1("Hello server.") ie, if that works, there should be no need to use _FlagAsMethod (indeed, it will fail) Mark From apocalypznow at yahoo.com Tue Sep 7 07:02:58 2004 From: apocalypznow at yahoo.com (apocalypznow) Date: Tue Sep 7 06:56:08 2004 Subject: [python-win32] Re: 'NoneType' object is not callable In-Reply-To: <02d401c49488$3d4a5040$0200a8c0@eden> References: <02d401c49488$3d4a5040$0200a8c0@eden> Message-ID: Thanks for your help Mark. I tried: mfcserver = mod.Application(mfcserver) but I get this error: AttributeError: 'NoneType' object has no attribute 'Application' But when I tried to mfcserver._FlagAsMethod('SendMessage1'), and upon execution of mfcserver.SendMessage1("hi"), IT WORKED! You say that the automation server is responding to the request as a *property*. However, here is the dispatch map: BEGIN_DISPATCH_MAP(CTestmfcserverDlgAutoProxy, CCmdTarget) //{{AFX_DISPATCH_MAP(CTestmfcserverDlgAutoProxy) DISP_FUNCTION(CTestmfcserverDlgAutoProxy, "SendMessage1", SendMessage1, VT_VARIANT, VTS_VARIANT) //}}AFX_DISPATCH_MAP END_DISPATCH_MAP() The makepy generated file shows it to be a method: class ITestmfcserver(DispatchBaseClass): CLSID = IID('{3EC90822-8332-4CEB-834B-36E453010E46}') coclass_clsid = IID('{7B898434-6DEE-499F-9820-6D337EF00D9C}') def SendMessage1(self, param1=defaultNamedNotOptArg): return self._ApplyTypes_(1, 1, (12, 0), ((12, 0),), 'SendMessage1', None,param1) _prop_map_get_ = { } _prop_map_put_ = { } This is very puzzling... I've been through the VC++ automation wizard at least 3 times, each time I am sure it is executing as a method (for example, I put in an AfxMessageBox() that executes in the body of the method). A VB client likewise has no problem with it. Can you give me some clue as to what might be happening? >>I always get this error when calling a function on the automation >>server: 'NoneType' object is not callable >>Then the python program stops executing. In the code below, >>mfcserver.SendMessage1() gives the error, and the print >>"Finished" line >>never executes. > > > Your COM server is reponding to a request for a *property* named > "SendMessage1", and returning None. Python it then attempting to call it. > You should raise DIS_E_MEMBERNOTFOUND when it is requested as a property. > > You can worm around that using: > ob._FlagAsMethod("SendMessage1") before trying to make the call. > > >>It looks as though the dispatch is happening dynamically. The error >>happens even if gencache is not used. > > > That means your object is not responding to GetTypeInfo() - so python has no > clue what type lib info to use. You should be able to worm around that by: > > mod = gencache.EnsureModule('{6CAC46EE-C71C-475C-B372-2E988DA78678x0x1x0}', > 0, 1, 0) > mfcserver = win32com.client.Dispatch("Testmfcserver.Application") > mfcserver = mod.Application(mfcserver) > mfcserver.SendMessage1("Hello server.") > > ie, if that works, there should be no need to use _FlagAsMethod (indeed, it > will fail) > > Mark From mhammond at skippinet.com.au Tue Sep 7 08:53:36 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 7 08:53:10 2004 Subject: [python-win32] Re: 'NoneType' object is not callable In-Reply-To: Message-ID: <030501c494a7$6a6d3e10$0200a8c0@eden> > This is very puzzling... I've been through the VC++ > automation wizard at > least 3 times, each time I am sure it is executing as a method (for > example, I put in an AfxMessageBox() that executes in the body of the > method). A VB client likewise has no problem with it. Can > you give me > some clue as to what might be happening? The problem will most likely be in the MFC "Invoke" implementation. You should be able to set a breakpoint in Invoke, and see that Python is calling it with just INVOKE_PROPERTYGET - not INVOKE_FUNC. I suspect the MFC code is not differentiating between being called with PROPERTYGET or FUNC - Python needs it to fail. > >>I always get this error when calling a function on the automation > >>server: 'NoneType' object is not callable > >>Then the python program stops executing. In the code below, > >>mfcserver.SendMessage1() gives the error, and the print > >>"Finished" line > >>never executes. > > > > > > Your COM server is reponding to a request for a *property* named > > "SendMessage1", and returning None. Python it then > attempting to call it. > > You should raise DIS_E_MEMBERNOTFOUND when it is requested > as a property. Mark From apocalypznow at yahoo.com Tue Sep 7 09:47:53 2004 From: apocalypznow at yahoo.com (apocalypznow) Date: Tue Sep 7 09:41:06 2004 Subject: [python-win32] Re: 'NoneType' object is not callable In-Reply-To: <030501c494a7$6a6d3e10$0200a8c0@eden> References: <030501c494a7$6a6d3e10$0200a8c0@eden> Message-ID: Should I be using ATL to build my automation server then, because it is cleaner? >>This is very puzzling... I've been through the VC++ >>automation wizard at >>least 3 times, each time I am sure it is executing as a method (for >>example, I put in an AfxMessageBox() that executes in the body of the >>method). A VB client likewise has no problem with it. Can >>you give me >>some clue as to what might be happening? > > > The problem will most likely be in the MFC "Invoke" implementation. You > should be able to set a breakpoint in Invoke, and see that Python is calling > it with just INVOKE_PROPERTYGET - not INVOKE_FUNC. I suspect the MFC code > is not differentiating between being called with PROPERTYGET or FUNC - > Python needs it to fail. > > >>>>I always get this error when calling a function on the automation >>>>server: 'NoneType' object is not callable >>>>Then the python program stops executing. In the code below, >>>>mfcserver.SendMessage1() gives the error, and the print >>>>"Finished" line >>>>never executes. >>> >>> >>>Your COM server is reponding to a request for a *property* named >>>"SendMessage1", and returning None. Python it then >> >>attempting to call it. >> >>>You should raise DIS_E_MEMBERNOTFOUND when it is requested >> >>as a property. > > > Mark From mhammond at skippinet.com.au Tue Sep 7 12:19:26 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 7 12:18:55 2004 Subject: [python-win32] Re: 'NoneType' object is not callable In-Reply-To: Message-ID: <034201c494c4$27db4980$0200a8c0@eden> > Should I be using ATL to build my automation server then, > because it is cleaner? No, you should be using Python to build your automation server :) If you *must* have some low-level C++ code, make it a Python extension. Thats-what-i'd-do-anyway Mark From Ian.Dickinson at littlewoodsgaming.com Mon Sep 6 13:32:10 2004 From: Ian.Dickinson at littlewoodsgaming.com (Ian Dickinson) Date: Tue Sep 7 19:27:49 2004 Subject: [python-win32] Accessing Midi Devices from Win 2000 Message-ID: HI I am interested in communicating with a midi device using python and Windows 2000 I am fairly familiar with Python and pygame, but not with windows development My aim is to write a config tool and midi sequencer in python The device that i need to comunicate with is compactable with standard windows midi callls (so the manufacturer tells me, but could or would not explain to me how I accessed the device using them) I have done a bit of investigation and was wondering if I could access the windows API mciSendString from python. I would be very grateful for any help with this problem or point me in the right direction Thanks in advance Ian ......................................................................... .................................................... CHANGE OF EMAIL ADDRESS Please be aware that all emails sent to Littlewoods-Leisure.com should now be sent to firstname.secondname@littlewoodsgaming.com. Please update your records accordingly. CONFIDENTIALITY NOTICE This e-mail and any files transmitted with it are confidential and may be privileged. It is intended solely for the use of the individual or entity to which it is addressed and any unauthorised use or disclosure is prohibited and may be unlawful. If you have received this e-mail in error you should not copy or use it for any purpose or disclose its contents to any person. You should return the e-mail and any attachments to the sender. VIRUSES This e-mail message has been swept by a program for the presence of computer viruses. The contents of any attachment may contain software viruses which could damage your own computer. While Littlewoods Gaming has taken reasonable precautions to minimise the risk of software viruses,it cannot accept liability for any damage which you may suffer as a result of such viruses. We recommend that you carry out your own virus checks before opening any attachment. ........................................................................ ..................................................... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040906/5ef31016/attachment.htm From tim.golden at viacom-outdoor.co.uk Wed Sep 8 09:19:20 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Sep 8 09:23:22 2004 Subject: [python-win32] Accessing Midi Devices from Win 2000 Message-ID: [Ian Dickinson] > I am interested in communicating with a midi > device using python and Windows 2000 [... snip ...] > I have done a bit of investigation and was wondering if I could access > the windows API mciSendString from python. OK. I know nothing about how to access Midi from Windows, so hopefully someone else will be able to help there. But to answer your most immediate question: yes, you can, if you use ctypes (http://starship.python.net/crew/theller/ctypes/) But it'll be a messy business trying to define all the data structures etc., and I bet someone's already done the hard work somewhere. Have you tried the main Python list on comp.lang.python? Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes >>> ctypes.windll.winmm >>> ctypes.windll.winmm.mciSendString Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\Lib\site-packages\ctypes\__init__.py", line 255, in __getattr__ self._name = name AttributeError: function 'mciSendString' not found >>> ctypes.windll.winmm.mciSendStringA >>> ctypes.windll.winmm.mciSendStringW >>> 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 ________________________________________________________________________ From niki at vintech.bg Wed Sep 8 14:07:23 2004 From: niki at vintech.bg (Niki Spahiev) Date: Wed Sep 8 14:07:51 2004 Subject: [python-win32] Hidden CLI In-Reply-To: <80150ed604090219332314493a@mail.gmail.com> References: <80150ed604090219332314493a@mail.gmail.com> Message-ID: <413EF5FB.9090605@vintech.bg> Lewis Franklin wrote: > My question is probably simple to those who have been programming in > Windows for some time, but I am having a difficult time with a > 'simple' problem. > > I have written a program that consists simply of three buttons (using > wxPython). Clicking one of those buttons triggers an event where curl > is executed and the information returned is stored into a file. The > command is simply: > > curl http://www.example.org?a=user^&b=pass -o setup.bat Use pycurl? Niki Spahiev From theller at python.net Wed Sep 8 20:58:26 2004 From: theller at python.net (Thomas Heller) Date: Wed Sep 8 20:58:34 2004 Subject: [python-win32] Re: Accessing Midi Devices from Win 2000 References: Message-ID: Tim Golden writes: > [Ian Dickinson] > >> I am interested in communicating with a midi >> device using python and Windows 2000 > [... snip ...] >> I have done a bit of investigation and was wondering if I could access >> the windows API mciSendString from python. > > OK. I know nothing about how to access Midi from Windows, so > hopefully someone else will be able to help there. But to > answer your most immediate question: yes, you can, if you > use ctypes (http://starship.python.net/crew/theller/ctypes/) > But it'll be a messy business trying to define all the > data structures etc., and I bet someone's already done > the hard work somewhere. There is hope for a ctypes solution for this problem. I'm playing with gccxml, which can parse windows header files and output them as XML. Then, it's easy (although quite some work) to parse the xml, and generate ctypes compatible Python code. For example, parsing with -D _WIN32_WINNT=0x500 creates 1056(!) public structure and union definitions. The more than 10000 constants defined in #define and enum {} statements must be added - so there is still some work to be done to avoid multi-megabyte Python modules to store these. But hopefully one day we will be able to write 'import winapi' and be able to access all of them in the same namespace. Thomas From davidrushby at yahoo.com Thu Sep 9 00:49:10 2004 From: davidrushby at yahoo.com (David Rushby) Date: Thu Sep 9 00:49:13 2004 Subject: [python-win32] How to determine whether program running as service? Message-ID: <20040908224910.74126.qmail@web11003.mail.yahoo.com> What's the canonical way to programmatically determine whether a pywin32-based Python program is running as a Windows service or as a regular process? This issue arises because Windows services don't have [functional] standard output streams, so even simple print statements will eventually cause the service to raise an unhandled exception. This typically causes the thread on which the exception arose to die, leaving the SCM-listener thread still running, but the service useless from the perspective of its clients. So, when running as a service, it's necessary to replace sys.stdout and sys.stderr with streams that redirect to somewhere other than the [dysfunctional] console--but there are some complications. For example, when the program is hosted by PythonService.exe but running in debug mode (via 'pythonservice -debug the_service_program.py'), the normal output streams are available, and because the program is being debugged, it should produce verbose output. In pre-200 builds of pywin32, one could simply: ------------------------------------------------ try: import servicemanager needToReplaceStdStreams = not servicemanager.Debugging() except ImportError: needToReplaceStdStreams = True else: needToReplaceStdStreams = False ------------------------------------------------ With build 200 and later, servicemanager can be imported by non-service processes, so the code above no longer works. Examining the name of the executable (sys.executable) won't work, because Python services don't require that PythonService.exe host them (a py2exe-fied service is a good example of a situation in which one might not want to use PythonService.exe). I noticed in the spambayes codebase that Mark Hammond appears to be implementing a test somewhat similar to this one with code like this: ------------------------------------------------ try: win32api.GetConsoleTitle() except win32api.error: # Not a regular process. else: # A regular process. ------------------------------------------------ That test is not suitable for service-or-regular-process detection purposes because there are many non-service execution contexts that lack a proper win32 console. win32api.GetConsoleTitle() fails in all of the graphical Python shells I've tried--including PythonWin--yet it's still desirable to print to the standard streams while running in a graphical shell. Can anyone advise me? Thanks. __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From mhammond at skippinet.com.au Thu Sep 9 06:13:10 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Sep 9 06:12:47 2004 Subject: [python-win32] How to determine whether program running as service? In-Reply-To: <20040908224910.74126.qmail@web11003.mail.yahoo.com> Message-ID: <03f301c49623$55920070$0200a8c0@eden> > What's the canonical way to programmatically determine whether a > pywin32-based Python program is running as a Windows service or as a > regular process? I don't see one :( I would be happy to add one - eg, sys.serviceexecutable being set to the host executable when launched as a service. That doesn't help you now though. Hmmm - actually: is_service = 'servicemanager' in sys.modules before your import of servicemanager would work - the framework imports this module before your module. However, that is ugly and just as error prone as catching the import error was. I agree something canonical and simple would be good. > Examining the name of the executable (sys.executable) won't work, > because Python services don't require that PythonService.exe host them > (a py2exe-fied service is a good example of a situation in which one > might not want to use PythonService.exe). And indeed PythonService.exe may die in later versions - python.exe could host services directly. That change was made specifically so py2exe can handle services. Mark. From davidrushby at yahoo.com Thu Sep 9 17:20:56 2004 From: davidrushby at yahoo.com (David Rushby) Date: Thu Sep 9 17:21:00 2004 Subject: [python-win32] How to determine whether program running as service? In-Reply-To: <03f301c49623$55920070$0200a8c0@eden> Message-ID: <20040909152056.39380.qmail@web11004.mail.yahoo.com> > > What's the canonical way to programmatically determine whether a > > pywin32-based Python program is running as a Windows service or as > > a regular process? > > I don't see one :( I would be happy to add one - eg, > sys.serviceexecutable being set to the host executable when > launched as a service. Why not something like this: servicemanager.RunningAsService() -> bool A RunningAsService predicate would keep the functionality grouped with other service-related predicates (e.g., servicemanager.Debugging)), would be ultra-simple for client code, and would encapsulate the service-mode-detection logic, insulating it from radical future changes of the sort that occurred between builds 1xx and 2xx. My previous needToReplaceStdStreams code could become as simple (and readable) as: ------------------------------------------------ import servicemanager needToReplaceStdStreams = servicemanager.RunningAsService() and not servicemanager.Debugging() ------------------------------------------------ > That doesn't help you now though. Actually, it would; this issue alone has prevented me from migrating to pywin32 >= 200. __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail From theller at python.net Thu Sep 9 19:40:40 2004 From: theller at python.net (Thomas Heller) Date: Thu Sep 9 19:40:53 2004 Subject: [python-win32] Re: How to determine whether program running as service? References: <03f301c49623$55920070$0200a8c0@eden> <20040909152056.39380.qmail@web11004.mail.yahoo.com> Message-ID: David Rushby writes: >> > What's the canonical way to programmatically determine whether a >> > pywin32-based Python program is running as a Windows service or as >> > a regular process? >> >> I don't see one :( I would be happy to add one - eg, >> sys.serviceexecutable being set to the host executable when >> launched as a service. Is it possible to determine that a process is launched as service? I don't think there is one, at least I didn't find one. Thomas From Mark at TriAxialData.com Thu Sep 9 22:53:11 2004 From: Mark at TriAxialData.com (Mark Lamoreaux) Date: Thu Sep 9 22:53:22 2004 Subject: [python-win32] Building Extensions with BCC Message-ID: Hi, I'm trying to use/test the IndexedCatalog extension on Windows. No binaries existed for this extension, so I'm trying to compile it. Unfortunately, I don't have Visual Studio 6.0. I do have Borland C++, though, and after several small adjustments, was able to successfully build the extension using: >python setup.py build --compiler=bcpp Now that I have it built, I assume I still need to install the extension. When I try: >python setup.py install I receive the following error: "Python was built with version 6 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed." I've read posts where others have successfully used extensions built with BCC in the past, so is there something I'm doing wrong in trying to finish the install, or does Python 2.3 no longer support building extensions with anything other than Visual Studio 6? Thanks! Mark From rwupole at msn.com Fri Sep 10 00:25:05 2004 From: rwupole at msn.com (Roger Upole) Date: Fri Sep 10 00:25:15 2004 Subject: [python-win32] Re: How to determine whether program running as service? References: <20040908224910.74126.qmail@web11003.mail.yahoo.com> Message-ID: <000c01c496bb$dc9fafc0$68148441@rupole> You could list running services using wmi, then check to see if your current process is amongst them. This is kind of roundabout but appears to work: import win32com.client, win32api wmi=win32com.client.Dispatch('wbemscripting.swbemlocator') ls=wmi.ConnectServer() plist=[] svcs=ls.InstancesOf('win32_service') for svc in svcs: plist.append(svc.Properties_('ProcessId').Value) if win32api.GetCurrentProcessId() in plist: print 'I am a service' Roger ----- Original Message ----- From: "David Rushby" To: Sent: Wednesday, September 08, 2004 6:49 PM Subject: [python-win32] How to determine whether program running as service? > What's the canonical way to programmatically determine whether a > pywin32-based Python program is running as a Windows service or as a > regular process? > > This issue arises because Windows services don't have [functional] > standard output streams, so even simple print statements will > eventually cause the service to raise an unhandled exception. This > typically causes the thread on which the exception arose to die, > leaving the SCM-listener thread still running, but the service useless > from the perspective of its clients. > > So, when running as a service, it's necessary to replace sys.stdout and > sys.stderr with streams that redirect to somewhere other than the > [dysfunctional] console--but there are some complications. For > example, when the program is hosted by PythonService.exe but running in > debug mode (via 'pythonservice -debug the_service_program.py'), the > normal output streams are available, and because the program is being > debugged, it should produce verbose output. > > In pre-200 builds of pywin32, one could simply: > ------------------------------------------------ > try: > import servicemanager > needToReplaceStdStreams = not servicemanager.Debugging() > except ImportError: > needToReplaceStdStreams = True > else: > needToReplaceStdStreams = False > ------------------------------------------------ > > With build 200 and later, servicemanager can be imported by non-service > processes, so the code above no longer works. > > Examining the name of the executable (sys.executable) won't work, > because Python services don't require that PythonService.exe host them > (a py2exe-fied service is a good example of a situation in which one > might not want to use PythonService.exe). > > I noticed in the spambayes codebase that Mark Hammond appears to be > implementing a test somewhat similar to this one with code like this: > ------------------------------------------------ > try: > win32api.GetConsoleTitle() > except win32api.error: > # Not a regular process. > else: > # A regular process. > ------------------------------------------------ > That test is not suitable for service-or-regular-process detection > purposes because there are many non-service execution contexts that > lack a proper win32 console. win32api.GetConsoleTitle() fails in all > of the graphical Python shells I've tried--including PythonWin--yet > it's still desirable to print to the standard streams while running in > a graphical shell. > > Can anyone advise me? > > Thanks. > > > > __________________________________ > Do you Yahoo!? > Take Yahoo! Mail with you! Get it on your mobile phone. > http://mobile.yahoo.com/maildemo > > From lewis.franklin at gmail.com Fri Sep 10 03:50:04 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Fri Sep 10 03:50:13 2004 Subject: [python-win32] ActiveX Message-ID: <80150ed604090918506b1ac644@mail.gmail.com> I know that you can ActiveX controls but am completely new to using them. I have a Topaz SignatureGem Signature Pad that uses an .ocx ActiveX Controller. However, I don't know how to import and use an ActiveX Controller. One of my co-workers has written an app in VB that uses this file and so I know the commands once I can import it, but I just need to know how to use an ActiveX Controller. Any help would be appreciated. Lewis From mhammond at skippinet.com.au Fri Sep 10 07:23:58 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Sep 10 07:23:31 2004 Subject: [python-win32] ActiveX In-Reply-To: <80150ed604090918506b1ac644@mail.gmail.com> Message-ID: <075501c496f6$609e12f0$0200a8c0@eden> > I know that you can ActiveX controls but am completely new to using > them. I have a Topaz SignatureGem Signature Pad that uses an .ocx > ActiveX Controller. However, I don't know how to import and use an > ActiveX Controller. One of my co-workers has written an app in VB that > uses this file and so I know the commands once I can import it, but I > just need to know how to use an ActiveX Controller. Any help would be > appreciated. If it really is a control with a GUI, then it is a bit harder - Python doesn't have full support for that yet. To use an OCX, you need to see either the pythonwin\pywin\demos\ocx demos (which unfortunately were not included in builds 200 and later - see then via the cvs at sourceforge.) I believe wxPython also has OCX support. If it displays no GUI, then all you needs is its "prog ID" - ie, its name - and use win32com.client.Dispatch(name) Mark. From mhammond at skippinet.com.au Fri Sep 10 07:47:43 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Sep 10 07:47:36 2004 Subject: [python-win32] Re: How to determine whether program running asservice? In-Reply-To: Message-ID: <077501c496f9$c02882c0$0200a8c0@eden> > >> I don't see one :( I would be happy to add one - eg, > >> sys.serviceexecutable being set to the host executable when > >> launched as a service. > > Is it possible to determine that a process is launched as service? I > don't think there is one, at least I didn't find one. No direct way I found - but service_main() could set a flag - this code knows for certain it is running as a service (or for debugging). Thinking about it a bit more - since this code exists in servicemanager.pyd, it makes the most sense for servicemanager.pyd itself to have these attributes. servicemanager.is_service = boolean servicemanager.is_debugging = boolean That shouldn't be too hard to setup. 'serviceexecutable' is a bit silly, but it kinda made sense given the various other sys.dll/executable variables used. But keeping it out of sys makes far more sense. Thoughts? Mark From mhammond at skippinet.com.au Fri Sep 10 07:53:09 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Sep 10 07:52:58 2004 Subject: [python-win32] How to determine whether program running asservice? In-Reply-To: <20040909152056.39380.qmail@web11004.mail.yahoo.com> Message-ID: <077801c496fa$7e8544b0$0200a8c0@eden> > > > What's the canonical way to programmatically determine whether a > > > pywin32-based Python program is running as a Windows service or as > > > a regular process? > > > > I don't see one :( I would be happy to add one - eg, > > sys.serviceexecutable being set to the host executable when > > launched as a service. > > Why not something like this: > servicemanager.RunningAsService() -> bool Yes, I agree - see my other post :) I just didn't think it through enough at the time - I recently stuck a sys.isapidllhandle in a new py2exe extension, and sys.frozendllhandle has existed for some time. I just had sys on the mind :) I think a simple attribute should be OK - no need for a function call. As I implied in my other mail, a simple way of knowing if you are being run for debugging may also help - at the moment you would need to imply that if is_service is False, you are being debugged - but that isn't necessarily true. Mark From tony at tcapp.com Fri Sep 10 07:54:12 2004 From: tony at tcapp.com (Tony Cappellini) Date: Fri Sep 10 07:54:26 2004 Subject: [python-win32] Re: Python-win32 Digest, Vol 18, Issue 9 In-Reply-To: <20040908100111.33E4D1E401D@bag.python.org> References: <20040908100111.33E4D1E401D@bag.python.org> Message-ID: <6.1.2.0.0.20040909224922.01f1c678@mail.yamato.com> >Message: 2 >Date: Mon, 06 Sep 2004 12:32:10 +0100 >From: "Ian Dickinson" >Subject: [python-win32] Accessing Midi Devices from Win 2000 >To: >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >HI > >I am interested in communicating with a midi device using python and >Windows 2000 > >I am fairly familiar with Python and pygame, but not with windows development > >My aim is to write a config tool and midi sequencer in python > >The device that i need to comunicate with is compactable with standard >windows midi callls (so the manufacturer tells me, but could or would not >explain to me how I accessed the device using them) > >I have done a bit of investigation and was wondering if I could access the >windows API mciSendString from python. > > >I would be very grateful for any help with this problem or point me in the >right direction > >Thanks in advance > >Ian Ian take a look at Peter Parente's PMidi. It may be a place to start. http://sourceforge.net/projects/uncassist Ooh, and google found something else I hadn't seen before http://pete.yandell.com/software/pymidi/Read%20Me.html I'm interested in sending/receiving sysex via python, myself, but haven't started on that project yet. Let me know how your project is coming along. tony From tony at tcapp.com Fri Sep 10 07:58:20 2004 From: tony at tcapp.com (Tony Cappellini) Date: Fri Sep 10 07:58:32 2004 Subject: [python-win32] Re: Python-win32 Digest, Vol 18, Issue 9-Python Midi Message-ID: <6.1.2.0.0.20040909225731.063cf8e8@wheresmymailserver.com> >Message: 2 >Date: Mon, 06 Sep 2004 12:32:10 +0100 >From: "Ian Dickinson" >Subject: [python-win32] Accessing Midi Devices from Win 2000 >To: >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >HI > >I am interested in communicating with a midi device using python and >Windows 2000 > >I am fairly familiar with Python and pygame, but not with windows development > >My aim is to write a config tool and midi sequencer in python > >The device that i need to comunicate with is compactable with standard >windows midi callls (so the manufacturer tells me, but could or would not >explain to me how I accessed the device using them) > >I have done a bit of investigation and was wondering if I could access the >windows API mciSendString from python. > > >I would be very grateful for any help with this problem or point me in the >right direction > >Thanks in advance > >Ian Ian The PyMidi package in my previous email is only for the MAC. Here's another thing that popped up from googling http://www.mxm.dk/products/public/pythonmidi take a look at Peter Parente's PMidi. It may be a place to start. http://sourceforge.net/projects/uncassist Ooh, and google found something else I hadn't seen before http://pete.yandell.com/software/pymidi/Read%20Me.html I'm interested in sending/receiving sysex via python, myself, but haven't started on that project yet. Let me know how your project is coming along. tony From theller at python.net Fri Sep 10 13:48:16 2004 From: theller at python.net (Thomas Heller) Date: Fri Sep 10 13:48:26 2004 Subject: [python-win32] Re: How to determine whether program running asservice? References: <077501c496f9$c02882c0$0200a8c0@eden> Message-ID: "Mark Hammond" writes: >> >> I don't see one :( I would be happy to add one - eg, >> >> sys.serviceexecutable being set to the host executable when >> >> launched as a service. >> >> Is it possible to determine that a process is launched as service? I >> don't think there is one, at least I didn't find one. > > No direct way I found - but service_main() could set a flag - this code > knows for certain it is running as a service (or for debugging). > > Thinking about it a bit more - since this code exists in servicemanager.pyd, > it makes the most sense for servicemanager.pyd itself to have these > attributes. > > servicemanager.is_service = boolean > servicemanager.is_debugging = boolean > > That shouldn't be too hard to setup. 'serviceexecutable' is a bit silly, > but it kinda made sense given the various other sys.dll/executable variables > used. But keeping it out of sys makes far more sense. I'm not sure I really understand, and don't have time too look into the code right now. Would it be possible with these changes to have code like this at the end of py2exe's boot_service.py: """ if launched_as_service: servicemanager.StartServiceControlDispatcher() """ so that the StartServiceControlDispatcher is not called when the service exe is started manually by the user? Thomas From davidrushby at yahoo.com Fri Sep 10 19:42:57 2004 From: davidrushby at yahoo.com (David Rushby) Date: Fri Sep 10 19:43:00 2004 Subject: [python-win32] How to determine whether program running asservice? In-Reply-To: <077801c496fa$7e8544b0$0200a8c0@eden> Message-ID: <20040910174257.62712.qmail@web11002.mail.yahoo.com> --- Mark Hammond wrote: > > Why not something like this: > > servicemanager.RunningAsService() -> bool > > Yes, I agree - see my other post :) [...] > I think a simple attribute should be OK - no need for a > function call. True enough, but what about symmetry with servicemanager.Debugging, which is a function? __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From markh at keypoint.com.au Fri Sep 10 08:06:00 2004 From: markh at keypoint.com.au (Mark Hammond) Date: Sat Sep 11 00:14:54 2004 Subject: [python-win32] How to determine whether program running asservice? In-Reply-To: <20040909152056.39380.qmail@web11004.mail.yahoo.com> Message-ID: <079e01c496fc$40c98490$0200a8c0@eden> > Why not something like this: > servicemanager.RunningAsService() -> bool > > A RunningAsService predicate would keep the functionality grouped with > other service-related predicates (e.g., servicemanager.Debugging)), *sigh* - I really should stop rushing :( Yes, Debugging() already exists - RunningAsService() fits better. Mark. From mhammond at skippinet.com.au Sat Sep 11 01:56:44 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Sep 11 01:56:12 2004 Subject: [python-win32] Re: How to determine whether program runningasservice? In-Reply-To: Message-ID: <099c01c49791$d46e7f80$0200a8c0@eden> > I'm not sure I really understand, and don't have time too > look into the > code right now. > > Would it be possible with these changes to have code like this at the > end of py2exe's boot_service.py: > > """ > if launched_as_service: > servicemanager.StartServiceControlDispatcher() > """ > > so that the StartServiceControlDispatcher is not called when > the service > exe is started manually by the user? I don't understand what you are asking - even when manually started by the user, we need to register with the SCM. The only exception is when we are debugging, when we don't make that call. Mark. From list at raefer.fastmail.fm Sun Sep 12 21:14:02 2004 From: list at raefer.fastmail.fm (Raefer Gabriel) Date: Sun Sep 12 21:14:06 2004 Subject: [python-win32] Strange PythonWin IDE crash, now persistent Message-ID: <200409121914.i8CJE26P032205@mail98.megamailservers.com> PythonWin has been working well for me as an IDE, until I started working with wxPython, when I experienced a crash of PythonWin while trying to debug a wxPython app. After searching around, I've found that PythonWin might not like having code from other toolkits running in its debugger. While I appreciate that, my problem is much worse: even after rebooting, every time I try to start PythonWin, I now get the main PythonWin window with an empty (no prompt) Interactive Window, and a modal error message window pops up titled "Microsoft Visual C++ Runtime Library" with the contents: "Runtime Error! Program: C:\Python23\Lib\site-packages\pythonwin\Pythonwin.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information." When I click on the OK button, PythonWin closes down. I tried uninstalling wxPython. I tried uninstalling pywinall and reinstalling. I tried doing a full uninstall of Python 2.3, rebooting, and reinstalling from scratch. None of this makes any difference, I now get the same error message EVERY time I try to start the PythonWin IDE. I tried this on another computer as well, and had the exact same problem after running the wxListCtrl sample through the debugger two or three times and playing around with it a bit. Sure enough, the same error message now comes up every time, and the same attempts to remedy it fail. Clearly something has persisted from the nasty wxPython/PythonWin interaction that even a complete reinstall of Python and all python libs hasn't fixed. To tell you the truth, I don't understand how this is even possible, unless some file that was not a part of my Python installation was corrupted in a predictable fashion, or something ended up in the registry that is causing this. Anybody have any ideas? At this point I'd be satisfied with a fix that will give me back the ability to run PythonWin on this computer, even if I never let it touch another line of wxPython code again. I'll use something else to work with my wxPython code if need be. For the record, I'm running Python 2.3 final, with the latest Build 202 pywin32 extensions. I was running the latest wxPython, 2.5.2.8 (I'd love to try this with the stable wxPython 2.4.2.4 to see if I have the same problem, but it's rather hard to test it again since I've gone through all my immediately available computers here). Thanks in advance, Raefer Gabriel From mhammond at skippinet.com.au Mon Sep 13 01:03:15 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Sep 13 01:03:08 2004 Subject: [python-win32] Strange PythonWin IDE crash, now persistent In-Reply-To: <200409121914.i8CJE26P032205@mail98.megamailservers.com> Message-ID: <044a01c4991c$bd2c5630$0200a8c0@eden> > PythonWin has been working well for me as an IDE, until I > started working > with wxPython, when I experienced a crash of PythonWin while > trying to debug > a wxPython app. After searching around, I've found that > PythonWin might not > like having code from other toolkits running in its debugger. While I > appreciate that, my problem is much worse: even after > rebooting, every time > I try to start PythonWin, I now get the main PythonWin window > with an empty > (no prompt) Interactive Window, and a modal error message > window pops up > titled "Microsoft Visual C++ Runtime Library" with the contents: > > "Runtime Error! > > Program: C:\Python23\Lib\site-packages\pythonwin\Pythonwin.exe > > This application has requested the Runtime to terminate it in > an unusual > way. Please contact the application's support team for more > information." > > When I click on the OK button, PythonWin closes down. That is a bit nasty. The only guesses off the top of my head are duplicate python23.dll or pywintypes23.dll. Another alternative would be a bad "PythonPath", or more likely, "Modules" key in the Python part of the registry. And finally, try nuking the registry key "HKEY_CURRENT_USER\Software\Python 2.3", and all subkeys - that is where Pythonwin config options are stored. Mark From list at raefer.fastmail.fm Mon Sep 13 02:03:51 2004 From: list at raefer.fastmail.fm (Raefer Gabriel) Date: Mon Sep 13 02:04:04 2004 Subject: [python-win32] RE: Strange PythonWin IDE crash, now persistent Message-ID: <200409130004.i8D041KG003062@mail99.megamailservers.com> Thanks for the excellent suggestions Mark. I just manually nuked the Python 2.3 registry keys as you suggested and reinstalled from the pywin32 build 202 installer, and it seems to have fixed the problem completely. So it looks like the crash somehow is corrupting the registry. I had sort of assumed before that the Uninstall procedure for pywin32 was cleaning up its own registry entries - maybe a nice thing to add in the future. Thanks again! Raefer -----Original Message----- From: Mark Hammond [mailto:mhammond@skippinet.com.au] Sent: Sunday, September 12, 2004 7:03 PM To: 'Raefer Gabriel'; python-win32@python.org Subject: RE: [python-win32] Strange PythonWin IDE crash, now persistent > PythonWin has been working well for me as an IDE, until I started > working with wxPython, when I experienced a crash of PythonWin while > trying to debug a wxPython app. After searching around, I've found > that PythonWin might not like having code from other toolkits running > in its debugger. While I appreciate that, my problem is much worse: > even after rebooting, every time I try to start PythonWin, I now get > the main PythonWin window with an empty (no prompt) Interactive > Window, and a modal error message window pops up titled "Microsoft > Visual C++ Runtime Library" with the contents: > > "Runtime Error! > > Program: C:\Python23\Lib\site-packages\pythonwin\Pythonwin.exe > > This application has requested the Runtime to terminate it in an > unusual way. Please contact the application's support team for more > information." > > When I click on the OK button, PythonWin closes down. That is a bit nasty. The only guesses off the top of my head are duplicate python23.dll or pywintypes23.dll. Another alternative would be a bad "PythonPath", or more likely, "Modules" key in the Python part of the registry. And finally, try nuking the registry key "HKEY_CURRENT_USER\Software\Python 2.3", and all subkeys - that is where Pythonwin config options are stored. Mark From mhammond at skippinet.com.au Mon Sep 13 03:24:36 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Sep 13 03:24:05 2004 Subject: [python-win32] RE: Strange PythonWin IDE crash, now persistent In-Reply-To: <20040913000220.5AD0FC15500@frontend1.messagingengine.com> Message-ID: <049601c49930$7113a7d0$0200a8c0@eden> > looks like the crash somehow is corrupting the registry. I > had sort of > assumed before that the Uninstall procedure for pywin32 was > cleaning up its > own registry entries - maybe a nice thing to add in the future. It is common for programs to leave behind "user preferences". Many people choose to uninstall a previous version before upgrading, and it would be a pain for this process to remove all your configuration options for pythonwin. Ideally, you would be asked at uninstall time - but that is beyond our installers AFAIK. Mark. From stephenemslie at gmail.com Mon Sep 13 14:03:08 2004 From: stephenemslie at gmail.com (stephen emslie) Date: Mon Sep 13 14:03:14 2004 Subject: [python-win32] extended MAPI error: outbox folder? Message-ID: <51f97e530409130503230971e8@mail.gmail.com> I short while ago David Frasure and I wrote a short piece of code for sending email using extended MAPI and posted it to this list. However, it seems that it doesn't work 100% of the time. Perhaps you can help me figure out why... I get the following error: outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS) TypeError: EntryID must be a string or None I think this basically means that it cant open the outbox (which needs to be done to create a new message in it). Below I've shown how the outbox is currently opened up till the point of the error. I'm almost sure that there must be a better way to gain access to the outbox folder. Does anyone know of a reliable method? The strange thing is that our code works perfectly on most systems. I am not sure why it works on some systems but not others. I got the current method of opening the outbox from an article on the code project (http://www.codeproject.com/internet/mapadmin.asp), specifically the createmessage function. here is the my code snippit up to the line that generates the error: # initialize and log on mapi.MAPIInitialize(None) session = mapi.MAPILogonEx(0, MAPIProfile, None, mapi.MAPI_EXTENDED | mapi.MAPI_USE_DEFAULT) adminprofiles = mapi.MAPIAdminProfiles(0) messagestorestable = session.GetMsgStoresTable(0) statustable = session.GetStatusTable(0) messagestorestable.SetColumns((mapitags.PR_ENTRYID, mapitags.PR_DISPLAY_NAME_A, mapitags.PR_DEFAULT_STORE),0) while (True): rows = messagestorestable.QueryRows(1, 0) if len(rows) != 1: break row = rows[0] property,value = row[0] if (property == mapitags.PR_DEFAULT_STORE and value == True): break # unpack the row and open the message store (eid_tag, eid), (name_tag, name), (def_store_tag, def_store) = row msgstore = session.OpenMsgStore(0,eid,None,mapi.MDB_NO_DIALOG | mapi.MAPI_BEST_ACCESS) # get the outbox hr, props = msgstore.GetProps((mapitags.PR_IPM_OUTBOX_ENTRYID), 0) (tag, eid) = props[0] outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS) Thanks for any help Stephen Emslie From harald.massa at suedvers.de Mon Sep 13 16:18:45 2004 From: harald.massa at suedvers.de (Massa, Harald) Date: Mon Sep 13 16:16:10 2004 Subject: [python-win32] Windows "scrolling in" like in gmail-notifier or outlook 2003.. Message-ID: <524506AA22C2104AA013A354F501D84C01390B6D@lorry.freiburg.suedvers.de> I really like this "scrolling in and out windows" right above the tray. (outlook 2003 shows "new mail" with such a window, or gmail notifier does the same) I am quite sure it is possible to do that with python on win32 ... and even more sure that somebody has done that before. Has anyone: - a code sample? - some hints for googling-keywords? (with fade-in window(s) I googled a lot of IE-code to fade in webpages and stuff also the exact english term for this windows would be very helpfull in my search. Thanks in advance, Harald -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040913/6c804971/attachment.htm From JLBD at CIGER.BE Mon Sep 13 14:14:19 2004 From: JLBD at CIGER.BE (Jean-Luc Bonduel) Date: Mon Sep 13 16:33:23 2004 Subject: [python-win32] win32com and DCOM Message-ID: <43101D2B73D34E449831D5F1BC57F2C301A46808@meribel.cigersoft.be> Hello, I have a Zope serveur (with the code infra) and i try to start Excel on the client PC. What i'm doing wrong ? TIA. Jean-Luc ------------------------------------------------------------------------ ------------------------- from win32com.client import DispatchEx import pythoncom import sys import time def demarreexcel(): COINIT = 0 pythoncom.CoInitializeEx(0) sys.coinit_flags = COINIT o = DispatchEx("Excel.Application","pcxyz") o.Visible = 1 o.Workbooks.Add() pythoncom.CoUninitializeEx() ------------------------------------------------------------------------ --------------------- Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module Products.ExternalMethod.ExternalMethod, line 224, in __call__ - __traceback_info__: ((), {}, None) Module c:\testp\Extensions\excelfct.py, line 11, in demarreexcel Module win32com.client, line 112, in DispatchEx com_error: (-2146959355, "\xc9chec de l'ex\xe9cution du serveur", None, None) "\xc9chec de l'ex\xe9cution du serveur" it's in french. It says a thing like: Error starting server From mhammond at skippinet.com.au Tue Sep 14 00:35:15 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 14 00:34:43 2004 Subject: [python-win32] Windows "scrolling in" like in gmail-notifier oroutlook 2003.. In-Reply-To: <524506AA22C2104AA013A354F501D84C01390B6D@lorry.freiburg.suedvers.de> Message-ID: <010a01c499e1$f1d9f160$0200a8c0@eden> NachrichtI think you want AnimateWindow. The current version of win32gui does not expose this, but the next version will. In the meantime you could try ctypes. Mark. -----Original Message----- From: python-win32-bounces+mhammond=keypoint.com.au@python.org [mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org]On Behalf Of Massa, Harald Sent: Tuesday, 14 September 2004 12:19 AM To: 'python-win32@python.org' Subject: [python-win32] Windows "scrolling in" like in gmail-notifier oroutlook 2003.. I really like this "scrolling in and out windows" right above the tray. (outlook 2003 shows "new mail" with such a window, or gmail notifier does the same) I am quite sure it is possible to do that with python on win32 ... and even more sure that somebody has done that before. Has anyone: - a code sample? - some hints for googling-keywords? (with fade-in window(s) I googled a lot of IE-code to fade in webpages and stuff also the exact english term for this windows would be very helpfull in my search. Thanks in advance, Harald -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040914/e12a226e/attachment.htm From mhammond at skippinet.com.au Tue Sep 14 00:40:26 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 14 00:39:55 2004 Subject: [python-win32] extended MAPI error: outbox folder? In-Reply-To: <51f97e530409130503230971e8@mail.gmail.com> Message-ID: <011c01c499e2$aac17400$0200a8c0@eden> > # get the outbox > hr, props = msgstore.GetProps((mapitags.PR_IPM_OUTBOX_ENTRYID), 0) > (tag, eid) = props[0] > outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS) I believe you will find PROP_TYPE(tag) == PT_ERROR, indicating there was an error fetching this specific property. The tag value will be the specific error code, which is a standard MAPI error. This may give you a clue. This is exactly why the tag is always returned with properties - even though you think you know the tag, what it returns may be different. For example, a common error for very large properties is MAPI_E_NOT_ENOUGH_MEMORY, indicating that you need to fetch the value some other way. I doubt this is the error code for the EID though! Mark. From harald.massa at suedvers.de Tue Sep 14 14:47:00 2004 From: harald.massa at suedvers.de (Massa, Harald) Date: Tue Sep 14 14:44:27 2004 Subject: AW: [python-win32] Windows "scrolling in" like in gmail-notifier oroutlook 2003.. Message-ID: <524506AA22C2104AA013A354F501D84C01390B72@lorry.freiburg.suedvers.de> Thank you very much for your Pointer, Mark. With "AnimateWindow" I was able to google it up ... I took also some Ctypes-Receipe out of the windows-cookbook, and ... for everyone to enjoy or not: # -*- coding: LATIN-1 -*- import win32con import sys from ctypes import * import time import threading WNDPROC = WINFUNCTYPE(c_long, c_int, c_uint, c_int, c_int) class WNDCLASS(Structure): _fields_ = [('style', c_uint), ('lpfnWndProc', WNDPROC), ('cbClsExtra', c_int), ('cbWndExtra', c_int), ('hInstance', c_int), ('hIcon', c_int), ('hCursor', c_int), ('hbrBackground', c_int), ('lpszMenuName', c_char_p), ('lpszClassName', c_char_p)] class RECT(Structure): _fields_ = [('left', c_long), ('top', c_long), ('right', c_long), ('bottom', c_long)] class PAINTSTRUCT(Structure): _fields_ = [('hdc', c_int), ('fErase', c_int), ('rcPaint', RECT), ('fRestore', c_int), ('fIncUpdate', c_int), ('rgbReserved', c_char * 32)] class POINT(Structure): _fields_ = [('x', c_long), ('y', c_long)] class MSG(Structure): _fields_ = [('hwnd', c_int), ('message', c_uint), ('wParam', c_int), ('lParam', c_int), ('time', c_int), ('pt', POINT)] def ErrorIfZero(handle): if handle == 0: raise WinError else: return handle class TrayNotifcation(object): def __init__(self, text='',breite=250,hoehe=60): self.maxx=windll.user32.GetSystemMetrics(win32con.SM_CXMAXIMIZED) self.maxy=windll.user32.GetSystemMetrics(win32con.SM_CYMAXIMIZED) self.text=text self.breite=breite self.hoehe=hoehe CreateWindowEx = windll.user32.CreateWindowExA CreateWindowEx.argtypes = [c_int, c_char_p, c_char_p, c_int, c_int, c_int, c_int, c_int, c_int, c_int, c_int, c_int] CreateWindowEx.restype = ErrorIfZero # Ctypes may already have something like this...? def makeCOLORREF(red, green, blue): return red + (green << 8) + (blue << 16) myBrush = windll.gdi32.CreateSolidBrush(makeCOLORREF(220, 255, 220)) # Define Window Class wndclass = WNDCLASS() wndclass.style = win32con.CS_HREDRAW | win32con.CS_VREDRAW wndclass.lpfnWndProc = WNDPROC(self.WndProc) wndclass.cbClsExtra = wndclass.cbWndExtra = 0 wndclass.hInstance = windll.kernel32.GetModuleHandleA(c_int(win32con.NULL)) wndclass.hIcon = windll.user32.LoadIconA(c_int(win32con.NULL), c_int(win32con.IDI_APPLICATION)) wndclass.hCursor = windll.user32.LoadCursorA(c_int(win32con.NULL), c_int(win32con.IDC_ARROW)) #wndclass.hbrBackground = windll.gdi32.GetStockObject(c_int(win32con.WHITE_BRUSH)) wndclass.hbrBackground =myBrush wndclass.lpszMenuName = None wndclass.lpszClassName = "TrayNotiWin" # Register Window Class if not windll.user32.RegisterClassA(byref(wndclass)): raise WinError() # Create Window self.hwnd = CreateWindowEx(0,#DWORD dwExStyle, wndclass.lpszClassName,#LPCTSTR lpClassName, "Python Window", #LPCTSTR lpWindowName, win32con.WS_POPUPWINDOW, #DWORD dwStyle, self.maxx-self.breite,# x self.maxy-self.hoehe,# y self.breite,# breite self.hoehe,# h?he win32con.NULL,#HWND hWndParent, win32con.NULL,#HMENU hMenu, wndclass.hInstance,#HINSTANCE hInstance, win32con.NULL#LPVOID lpParam ) def notify(self,text=None): if text: self.text=text windll.user32.ShowWindow(c_int(self.hwnd), c_int(win32con.SW_SHOWNORMAL)) windll.user32.UpdateWindow(c_int(self.hwnd)) #print self.hwnd class killer(threading.Thread): def run(my): time.sleep(1.8) windll.user32.ShowWindow(c_int(self.hwnd),c_int(win32con.SW_HIDE)) killer().start() def close(self): windll.user32.PostMessageA(self.hwnd, win32con.WM_CLOSE, 0, 0) def __del__(self): """Fenster entfernen""" windll.user32.PostMessageA(self.hwnd, win32con.WM_CLOSE, 0, 0) def WndProc(self,hwnd, message, wParam, lParam): ps = PAINTSTRUCT() rect = RECT() if message == win32con.WM_PRINTCLIENT: hdc=wParam #print "wm_printclient erhalten" windll.user32.GetClientRect(c_int(hwnd), byref(rect)) windll.gdi32.SetBkMode(hdc,win32con.TRANSPARENT) rect.top=rect.top+4 rect.left=rect.left+4 windll.user32.DrawTextA(c_int(hdc), self.text, c_int(-1), byref(rect), win32con.DT_TOP) elif message == win32con.WM_SHOWWINDOW: #print "ShowWindow erhalten" bShown = wParam if bShown: windll.user32.AnimateWindow(c_int(hwnd),c_int(280),c_int(win32con.AW_SLIDE|w in32con.AW_VER_NEGATIVE)) else: windll.user32.AnimateWindow(c_int(hwnd),c_int(280),c_int(win32con.AW_SLIDE|w in32con.AW_VER_POSITIVE|win32con.AW_HIDE)) return 0 elif message == win32con.WM_PAINT: #print "Paint bekommen" hdc = windll.user32.BeginPaint(c_int(hwnd), byref(ps)) windll.user32.GetClientRect(c_int(hwnd), byref(rect)) windll.user32.DrawTextA(c_int(hdc), self.text, c_int(-1), byref(rect), win32con.DT_TOP) windll.user32.EndPaint(c_int(hwnd), byref(ps)) return 0 elif message == win32con.WM_DESTROY: #print "wmdestroy" windll.user32.PostQuitMessage(0) return 0 return windll.user32.DefWindowProcA(c_int(hwnd), c_int(message), c_int(wParam), c_int(lParam)) if __name__=="__main__": nt=TrayNotifcation("hey, hey, wickie") nt.notify() class waiter(threading.Thread): def run(self): time.sleep(3) nt.close() waiter().start() msg = MSG() pMsg = pointer(msg) NULL = c_int(win32con.NULL) while windll.user32.GetMessageA( pMsg, NULL, 0, 0) != 0: windll.user32.TranslateMessage(pMsg) windll.user32.DispatchMessageA(pMsg) print "das war es" nt.close() -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040914/90208a72/attachment.htm From tamike at noos.fr Tue Sep 14 14:26:28 2004 From: tamike at noos.fr (tamike@noos.fr) Date: Tue Sep 14 19:10:14 2004 Subject: [python-win32] shortcut creation during installation Message-ID: Hello everyone, I don't know much about the windows environment. I want to distribute my program for windows users and create shortcuts on desktop and in the start menu : For this I wrote a script setup.py and a post-installation script (used by the win32 executable) which creates links with the function create_shortcut( target, description, filename[, arguments[, workdir[, iconpath[, iconindex]]]]) The first link try to launch python with a script as argument, so values are : target=os.path.join(sys.exec_prefix,"python.exe") description="..." shortcut=os.path.join(some_dir,"mylink.lnk") arguments="path_to_myscript.py" and finally create_shortcut(target,description,shortcut,arguments) This creates a link but when it is activated, it tells "C:\Python23\python.exe is not a valid Win32 application." This sounds like the problem is coming from the file C:\Python23\python.exe and not from the shortcut I just create. Is something wrong with the way I make the link ? My second link starts Acrobat reader with a file as argument. This time, values are : target=os.path.join( "C:\\Program Files\\Adobe\\Acrobat 5.\\Acrobat", "Acrobat.exe") description="..." shortcut=os.path.join(some_dir,"Mydocumentpdf.lnk") arguments="path_to_doc.pdf" create_shortcut(target,description,shortcut,arguments) This works fine! :) But my path to acrobat reader (i.e. in target) may not be the same for an other windows user. Is there a way to find the path to the executable of a program ? (something similar to get_special_folder_path ...) Thanks, Mike From emmanuel.breton at logilab.fr Wed Sep 15 09:53:53 2004 From: emmanuel.breton at logilab.fr (Emmanuel Breton) Date: Wed Sep 15 09:53:55 2004 Subject: [python-win32] shortcut creation during installation In-Reply-To: References: Message-ID: <20040915075353.GC913@logilab.fr> On Tue, Sep 14, 2004 at 02:26:28PM +0000, tamike@noos.fr wrote: > I want to distribute my program for windows users and create > shortcuts on desktop and in the start menu : What you could do is use an installer like Inno Setup (which is free and really efficient). It will take in charge the creation of icons, shortcut and also prompt the user for the application path. http://www.jrsoftware.org/ > > For this I wrote a script setup.py and a post-installation script (used by the win32 executable) which creates links with the function > What I have experienced so far looks the same: I have made a distrib with py2exe, (which plugs itself into setup.py). Then I create my installation script within Inno format and get as a result a single file which installs everything (as it is usually done with professional application) > > > My second link starts Acrobat reader with a file as argument. This time, values are : [...] > But my path to acrobat reader (i.e. in target) may not be the same for an other windows user. If you create a shorcut with target set on your pdf file, it should be sufficient, Windows will find out the reader automatically. (as long as MIME types are correctly defined) -- Emmanuel Br?ton LOGILAB, Paris (France) Tel: 01 45 32 03 12 http://www.logilab.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040915/f4b5083e/attachment.pgp From Mark at TriAxialData.com Wed Sep 15 20:39:52 2004 From: Mark at TriAxialData.com (Mark Lamoreaux) Date: Wed Sep 15 20:40:01 2004 Subject: [python-win32] Building Extensions with BCC Message-ID: Thanks for suggestion Andrew. Unfortunately, the compiler switch only works for the build command, not the install (i.e. it is not an option for the install command). I downloaded the free Microsoft Visual C toolkit, but it must have a newer version of their compiler and Python refused to build or install using it. I went back and re-built with the Borland compiler, and instead of using the automatic install, I copied the files to the appropriate places and now the library seems to work fine. I'll probably want to get Visual Studio 6 and recompile before putting the extension in a production mode, though. -----Original Message----- From: Andrew MacIntyre [mailto:Andrew.MacIntyre@aba.gov.au] Sent: Thursday, September 09, 2004 5:03 PM To: Mark Lamoreaux Subject: RE: [python-win32] Building Extensions with BCC Supply the compiler switch to the install command. ----------------------------------------------------------------------- Andrew MacIntyre \ E-mail: andrew.macintyre@aba.gov.au Planning Branch \ Tel: +61 2 6256 2812 Australian Broadcasting Authority \ Fax: +61 2 6253 3277 -> "These thoughts are mine alone!" <---------------------------------- > -----Original Message----- > From: Mark Lamoreaux [mailto:Mark@TriAxialData.com] > Sent: Friday, 10 September 2004 6:53 AM > To: python-win32@python.org > Subject: [python-win32] Building Extensions with BCC > > > Hi, > > I'm trying to use/test the IndexedCatalog extension on > Windows. No binaries existed for this extension, so I'm > trying to compile it. Unfortunately, I don't have Visual > Studio 6.0. I do have Borland C++, though, and after several > small adjustments, was able to successfully build the extension using: > >python setup.py build --compiler=bcpp > > Now that I have it built, I assume I still need to install > the extension. When I try: > >python setup.py install > I receive the following error: "Python was built with > version 6 of Visual Studio, and extensions need to be built > with the same version of the compiler, but it isn't installed." > > I've read posts where others have successfully used > extensions built with BCC in the past, so is there something > I'm doing wrong in trying to finish the install, or does > Python 2.3 no longer support building extensions with > anything other than Visual Studio 6? > > Thanks! > Mark > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From jjl at pobox.com Wed Sep 15 21:25:26 2004 From: jjl at pobox.com (John J Lee) Date: Wed Sep 15 21:25:29 2004 Subject: [python-win32] Building Extensions with BCC In-Reply-To: References: Message-ID: On Wed, 15 Sep 2004, Mark Lamoreaux wrote: [...] > Unfortunately, the compiler switch only works for the build command, not > the install (i.e. it is not an option for the install command). I [...] There's a way around that: http://www.google.com/groups?selm=isp8w9ok.fsf%40python.net&rnum=6 John From mhammond at skippinet.com.au Thu Sep 16 01:13:29 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Sep 16 01:12:59 2004 Subject: [python-win32] shortcut creation during installation In-Reply-To: Message-ID: <051d01c49b79$9d3e7240$0300a8c0@eden> > The first link try to launch python with a script as > argument, so values are : > > target=os.path.join(sys.exec_prefix,"python.exe") > description="..." > shortcut=os.path.join(some_dir,"mylink.lnk") > arguments="path_to_myscript.py" > > and finally > create_shortcut(target,description,shortcut,arguments) > > This creates a link but when it is activated, it tells > "C:\Python23\python.exe is not a valid Win32 application." > This sounds like the problem is coming from the file > C:\Python23\python.exe and not from the shortcut I just > create. Is something wrong with the way I make the link ? That looks fine to me, so I am surprised. Did you try looking at the link properties in Windows, and seeing what they said? Try getting the link to work from windows to see what went wrong and transfer that back to the code. Also, look for win32com\shell\test\link.py - it creates links from "first principals". > My second link starts Acrobat reader with a file as argument. > This time, values are : > > target=os.path.join( > "C:\\Program Files\\Adobe\\Acrobat 5.\\Acrobat", > "Acrobat.exe") > description="..." > shortcut=os.path.join(some_dir,"Mydocumentpdf.lnk") > arguments="path_to_doc.pdf" > > create_shortcut(target,description,shortcut,arguments) > > This works fine! :) > But my path to acrobat reader (i.e. in target) may not be the > same for an other windows user. > Is there a way to find the path to the executable of a > program ? (something similar to get_special_folder_path ...) I vaguely recall you can just set the path to the PDF - and Windows takes care of the rest. If not, win32api.FindExecutable is what you need. Mark From rogelio.flores at gmail.com Thu Sep 16 17:29:20 2004 From: rogelio.flores at gmail.com (Rogelio Flores) Date: Thu Sep 16 17:29:23 2004 Subject: [python-win32] Timeout waiting for windows (python) service to connect Message-ID: Trying to run a python application as a windows service, I get these two errors from the SCM: Event ID: 7009 Description: Timeout (30000 milliseconds) waiting for the X service to connect. Event ID: 7000 Description: The X service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion. I get the same errors from the demo "Pipe Test Service" that comes with the win32 extensions. I can run my service with the debug option so it seems to be related to the SCM connection, but I don't know how to troubleshoot this and find a the exact problem. The python application I'm trying to run is a legacy python 1.5 application (no choice to upgrade to a more recent version). Using win32 extensions build 143, and I did a manual installation of the modules---not sure if this has something to do with it. Could somebody help? -- Rogelio From robin at reportlab.com Fri Sep 17 14:38:41 2004 From: robin at reportlab.com (Robin Becker) Date: Fri Sep 17 14:38:46 2004 Subject: [python-win32] Pythonwin vs registry strangeness Message-ID: <414ADAD1.5050703@chamonix.reportlab.co.uk> I keep getting this problem in pythonwin 2.3 (202) where large numbers of registry entries get created this causes Ptyhonwin startup/exit to slow to a crawl. The entries are of the form HKEY_USERS\S-1-5-21-4066902308-2678863128-2210784394-500\Software\Python 2.3\Python for Win32\ToolbarDebugging-Bar1010 I've tried various deletions, but I believe I need to reinstall after delting to get the problem to really go away. -- Robin Becker From theller at python.net Fri Sep 17 15:51:28 2004 From: theller at python.net (Thomas Heller) Date: Fri Sep 17 15:51:44 2004 Subject: [python-win32] Re: AW: Windows "scrolling in" like in gmail-notifier oroutlook 2003.. References: <524506AA22C2104AA013A354F501D84C01390B72@lorry.freiburg.suedvers.de> Message-ID: "Massa, Harald" writes: > Thank you very much for your Pointer, Mark. With "AnimateWindow" I was able > to google it up ... > > I took also some Ctypes-Receipe out of the windows-cookbook, and ... for > everyone to enjoy or not: [snip code, mangled by the emailer] Wouldn't it make sense to post this to the ctypes wiki? Thomas From Martin.Gfeller at comit.ch Sat Sep 18 12:42:42 2004 From: Martin.Gfeller at comit.ch (Gfeller Martin) Date: Sat Sep 18 12:42:50 2004 Subject: [python-win32] Pythonwin vs registry strangeness Message-ID: Robin, please refer to the following bug entries in SourceForge: http://sourceforge.net/tracker/index.php?func=detail&aid=1017504&group_i d=78018&atid=551954 http://sourceforge.net/tracker/?group_id=78018&atid=551954&func=detail&a id=944506 The comments in 944506 suggest decommenting some lines in Pythonwin\pywin\debugger\debugger.py. Decommening line 467 helped for me. Btw, I get the problem (every time i Use the debugger) on Windows 2000; never on XP. Best regards, Martin Gfeller -----Original Message----- From: Robin Becker [mailto:robin@reportlab.com] Sent: Friday, September 17, 2004 2:39 PM To: python-win32@python.org Subject: [python-win32] Pythonwin vs registry strangeness I keep getting this problem in pythonwin 2.3 (202) where large numbers of registry entries get created this causes Ptyhonwin startup/exit to slow to a crawl. The entries are of the form HKEY_USERS\S-1-5-21-4066902308-2678863128-2210784394-500\Software\Python 2.3\Python for Win32\ToolbarDebugging-Bar1010 I've tried various deletions, but I believe I need to reinstall after delting to get the problem to really go away. -- Robin Becker From robin at reportlab.com Sat Sep 18 17:43:30 2004 From: robin at reportlab.com (Robin Becker) Date: Sat Sep 18 17:43:35 2004 Subject: [python-win32] XMetal & pyhton scripting Message-ID: <414C57A2.6050104@jessikat.fsnet.co.uk> A former colleague managed to get XMetal to do python scripting, but another says that even after executing the pyscript.py/pyscript_rexec.py scripts he cannot get XMetal Author to work. I can't think of anything more I should do on the python side, but I am not experienced with XMetal. Any assistance will be gratefully receieved. -- Robin Becker From mhammond at skippinet.com.au Sun Sep 19 00:54:11 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun Sep 19 00:53:35 2004 Subject: [python-win32] XMetal & pyhton scripting In-Reply-To: <414C57A2.6050104@jessikat.fsnet.co.uk> Message-ID: <0c1001c49dd2$6a2b1d80$0300a8c0@eden> > A former colleague managed to get XMetal to do python scripting, but > another says that even after executing the > pyscript.py/pyscript_rexec.py > scripts he cannot get XMetal Author to work. I can't think of > anything > more I should do on the python side, but I am not experienced > with XMetal. There is nothing else you should need to. You should register pyscript.py with "--debug", then use the win32traceutil tool to try and track down the any exceptions or strange message generated while running. That should at least tell you what the problem is. Mark From lewis.franklin at gmail.com Mon Sep 20 09:03:16 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Mon Sep 20 09:03:21 2004 Subject: [python-win32] Finding and Exiting a Process Message-ID: <80150ed6040920000358122536@mail.gmail.com> I have a program I have developed that opens a custom VB script. I want to be able to start and end the script; however, the script actually spawns a new program and therefore has a new process ID. Unfortunately, due to the nature of the script, the VB script cannot be rewritten. My question is if there is any way to find the process ID of the new program, either by capturing it when it is spawned or by somehow identifying the process (I do know the program name of the spawned program if that somehow helps). If needed, I can provide the VB app. Thanks in advance for the help. Lewis From JLBD at CIGER.BE Mon Sep 20 10:25:30 2004 From: JLBD at CIGER.BE (Jean-Luc Bonduel) Date: Mon Sep 20 10:25:43 2004 Subject: [python-win32] win32com and DCOM (the reply) Message-ID: <43101D2B73D34E449831D5F1BC57F2C301A46E1A@meribel.cigersoft.be> Hello, I have post this question some days (see below) After some search (a lot of...), i found this article at http://www.codeproject.com/com/dcomcnfg.asp It open the door for the communication between my server and my client... HTH. Jean-Luc >>Hello, >> >>I have a Zope serveur (with the code infra) and i try to start Excel on >>the client PC. >>What i'm doing wrong ? >> >>TIA. >> >>Jean-Luc >> >>---------------------------------------------------------------------- -- >>------------------------- >>from win32com.client import DispatchEx >>import pythoncom >>import sys >>import time >> >>def demarreexcel(): >> COINIT = 0 >> pythoncom.CoInitializeEx(0) >> sys.coinit_flags = COINIT >> o = DispatchEx("Excel.Application","pcxyz") >> o.Visible = 1 >> o.Workbooks.Add() >> pythoncom.CoUninitializeEx() >> >>---------------------------------------------------------------------- -- >>--------------------- >>Traceback (innermost last): >> Module ZPublisher.Publish, line 100, in publish >> Module ZPublisher.mapply, line 88, in mapply >> Module ZPublisher.Publish, line 40, in call_object >> Module Products.ExternalMethod.ExternalMethod, line 224, in __call__ >> - __traceback_info__: ((), {}, None) >> Module c:\testp\Extensions\excelfct.py, line 11, in demarreexcel >> Module win32com.client, line 112, in DispatchEx >>com_error: (-2146959355, "\xc9chec de l'ex\xe9cution du serveur", None, >>None) >>"\xc9chec de l'ex\xe9cution du serveur" >>it's in french. It says a thing like: Error starting server From tim.golden at viacom-outdoor.co.uk Mon Sep 20 10:55:36 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon Sep 20 11:00:10 2004 Subject: [python-win32] Finding and Exiting a Process Message-ID: [Lewis Franklin] | I have a program I have developed that opens a custom VB script. I | want to be able to start and end the script; however, the script | actually spawns a new program and therefore has a new process ID. | Unfortunately, due to the nature of the script, the VB script cannot | be rewritten. | | My question is if there is any way to find the process ID of the new | program, either by capturing it when it is spawned or by somehow | identifying the process (I do know the program name of the spawned | program if that somehow helps). If I understand you, you have a python program which launches an external VB program (not clear if it matters that it is VB; presumably it's an .EXE file). You want to know what that spawned process is to be able to terminate it? If that's it, then one way (which I haven't used) is to use ShellExecuteEx from win32com.shell.shell. That will return a process handle which you can then wait on etc. If that's not an option, there are ways of trawling the process list to find a running program by name etc. Here's one from the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305279 Another way is WMI: http://tgolden.sc.sabren.com/python/wmi_cookbook.html#watch_notepad Trent Mick's process package might help: http://starship.python.net/~tmick/index.html#process ... or the module formerly known as popen5: http://www.lysator.liu.se/~astrand/popen5/ Or, failing that, you can try Simon Brunning's techniques for finding open windows/controls by name: http://www.brunningonline.net/simon/blog/archives/000664.html HTH 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 ________________________________________________________________________ From cedric.delfosse at linbox.com Mon Sep 20 11:15:17 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Mon Sep 20 11:15:20 2004 Subject: [python-win32] Finding and Exiting a Process In-Reply-To: <80150ed6040920000358122536@mail.gmail.com> References: <80150ed6040920000358122536@mail.gmail.com> Message-ID: <1095671716.28939.11.camel@replic.metz> Le lun 20/09/2004 ? 09:03, Lewis Franklin a ?crit : > [...] > My question is if there is any way to find the process ID of the new > program, either by capturing it when it is spawned or by somehow > identifying the process (I do know the program name of the spawned > program if that somehow helps). To get all the pids of processes with a given name, I use this code: def get_pid(name): # Flush process info internal cache win32pdh.EnumObjects(None, None, 0, 1) object = win32pdhutil.find_pdh_counter_localized_name("Process") try: items, instances = win32pdh.EnumObjectItems(None, None, object, win32pdh.PERF_DETAIL_WIZARD) except win32api.error: print "Error" return [] # Need to track multiple instances of the same name. instance_dict = {} for instance in instances: try: instance_dict[instance] = instance_dict[instance] + 1 except KeyError: instance_dict[instance] = 0 items = [win32pdhutil.find_pdh_counter_localized_name("ID Process")] result = [] for instance, max_instances in instance_dict.items(): for inum in xrange(max_instances+1): hq = win32pdh.OpenQuery() hcs = [] path = win32pdh.MakeCounterPath( (None,object,instance, None, inum, win32pdhutil.find_pdh_counter_localized_name('ID Process')) ) hcs.append(win32pdh.AddCounter(hq, path)) try: try: win32pdh.CollectQueryData(hq) for hc in hcs: try: type, val = win32pdh.GetFormattedCounterValue(hc, win32pdh.PDH_FMT_LONG) if instance == name: result.append(val) finally: win32pdh.RemoveCounter(hc) finally: win32pdh.CloseQuery(hq) except win32api.error: # Sometimes some calls fails on NT, I don't know why ... pass return result Regards, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From cedric.delfosse at linbox.com Mon Sep 20 11:58:11 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Mon Sep 20 11:58:13 2004 Subject: [python-win32] Problem with Excel PrintOut method and pythoncom Message-ID: <1095674290.28945.71.camel@replic.metz> Hello, the behaviour of the PrintOut function seems different according to the MS Excel version. The chunk of code I use to print an Excel document into a file is: self.doc.PrintOut(PrToFileName = tofile, ActivePrinter = params['printer'], PrintToFile = 1) This works very well with "Microsoft Office 2000 Premium SR1 French". The same code with "Microsoft Office XP Pro French" doesn't fail, but Excel open a window asking the file name to print into !? It should not, because the PrToFileName argument is already filled with the file name. Do you have an idea of what's going on ? I thought that maybe the problem was the files generated by Makepy. But doing a diff of the two files (the 2 Excel versions) with a 'grep PrintOut' displayed no result. Regards, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From garyo at genarts.com Thu Sep 16 22:34:13 2004 From: garyo at genarts.com (Gary Oberbrunner) Date: Mon Sep 20 17:00:49 2004 Subject: [python-win32] Python COM server: can it generate events? Message-ID: <4149F8C5.3080009@genarts.com> Is it possible to make a Python COM server which can generate COM events? I know how to make attributes and methods, but either I've missed the event section in the doc, or maybe it's not possible? I'd like to make an asynchronous COM server which can send events back to its container (the VB container implements the event handlers, e.g. OnMyEvent, and that code should run when the Python code calls "RaiseMyEvent" or whatever). Is this possible? -- Gary PS: Please respond directly to me, as I'm not on this list. From graemeglass at gmail.com Mon Sep 20 15:56:22 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Mon Sep 20 17:00:50 2004 Subject: [python-win32] Mozilla address book and the ever smiling snake Message-ID: I am trying to access mozilla's address book in a similar manner to the way one accesses the address book in outlook. ie: object = win32com.client.Dispatch("Outlook.Application") but it is not wanting to happen for me. If anyone has any ideas, would be great. Thanks, Graeme From bluedust at swbell.net Mon Sep 20 17:36:53 2004 From: bluedust at swbell.net (Christopher Martin) Date: Mon Sep 20 17:36:56 2004 Subject: [python-win32] Using Tix with Python 2.3.3 (win32) Message-ID: <20040920153653.19294.qmail@web81404.mail.yahoo.com> I cannot get Tix to work with Python 2.3.3 under windows. Tkinter works fine (and with more complicated scripts, too). Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Tkinter >>> root = Tkinter.Tk() >>> Here is the output of an attempted Tix session: Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Tix >>> root = Tix.Tk() Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\lib\lib-tk\Tix.py", line 210, in _init__ self.tk.eval('package require Tix') _tkinter.TclError: couldn't load library "c:/python23/DLLs/tix8183.dll": this library or a dependent library could not be found in library path >>> I have tried installing it both by building by source and by the binaries from IDEStudio: http://starship.python.net/crew/mike/src/idledev/IDEStudio.html I've tried a number of different C:\python23\tcl\tix8.1\pkgIndex.tcl files, including the one recommended in the python docs: package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix] and another I found in a net search: package ifneeded Tix 8.1 \ [list load [file join [file dirname [info nameofexe]] DLLs tix8183.dll] Tix] package ifneeded wm_default 1.0 [list source [file join $dir pref WmDefault.tcl]] The tix8183.dll does exist in both the DLLs directory and the tcl/tix8.1 directory. What do I need to do to make this work? Is there an environmental variable I need to setup somehow? Is there additional information I can provide? Thanks, Chris From theller at python.net Mon Sep 20 17:53:51 2004 From: theller at python.net (Thomas Heller) Date: Mon Sep 20 17:53:54 2004 Subject: [python-win32] Re: Using Tix with Python 2.3.3 (win32) References: <20040920153653.19294.qmail@web81404.mail.yahoo.com> Message-ID: Christopher Martin writes: > I cannot get Tix to work with Python 2.3.3 under > windows. Tkinter works fine (and with more complicated > scripts, too). Python 2.3.4 for Windows comes with tix included. Thomas From lewis.franklin at gmail.com Mon Sep 20 18:16:19 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Mon Sep 20 18:16:22 2004 Subject: [python-win32] Finding and Exiting a Process In-Reply-To: <80150ed6040920085015da0c6e@mail.gmail.com> References: <80150ed6040920000358122536@mail.gmail.com> <1095671716.28939.11.camel@replic.metz> <80150ed6040920085015da0c6e@mail.gmail.com> Message-ID: <80150ed6040920091620cddfe6@mail.gmail.com> Note to self: Do not write emails at 3am... Ok, thanks to Cedric I now have both the process name and ID. However, I have now realized that I have no idea how to terminate that program. Am I able to terminate an application by only knowing the process name/ID? Lewis From lewis.franklin at gmail.com Mon Sep 20 18:43:05 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Mon Sep 20 18:43:13 2004 Subject: [python-win32] Finding and Exiting a Process In-Reply-To: <80150ed6040920091620cddfe6@mail.gmail.com> References: <80150ed6040920000358122536@mail.gmail.com> <1095671716.28939.11.camel@replic.metz> <80150ed6040920085015da0c6e@mail.gmail.com> <80150ed6040920091620cddfe6@mail.gmail.com> Message-ID: <80150ed604092009435b27dc95@mail.gmail.com> I just answered my own question: pid = self.get_pid('iexplore') # Cedric's function hp = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS,0, pid[0]) win32process.TerminateProcess(hp, 0) Thanks and sorry for the spam. Lewis On Mon, 20 Sep 2004 12:16:19 -0400, Lewis Franklin wrote: > Note to self: Do not write emails at 3am... > > Ok, thanks to Cedric I now have both the process name and ID. However, > I have now realized that I have no idea how to terminate that program. > Am I able to terminate an application by only knowing the process > name/ID? > > Lewis > From Mark.English at liffe.com Tue Sep 21 11:43:49 2004 From: Mark.English at liffe.com (Mark English) Date: Tue Sep 21 11:43:54 2004 Subject: [python-win32] Distutils and binaries without compilation Message-ID: <40E605146701DE428FAF21286A97D3091744B0@wphexa02.corp.lh.int> The short version of this question is how do you include binaries in a distribution without including their source ? The long version follows... I have a Python package I want to distribute internally to my company which makes use of pure python modules and C-extensions (.pyd files) under Windows (and hopefully one day Unix too). The build for the extensions is large and arduous so I do not want to include the source. I would rather just include the compiled binaries so that when the user installs the package they are written into the relevant location and the whole thing is ready to go. My structure is something like: SomePlaceOnPythonPath/ setup.py #Hard at work getting this to go Start/ __init__.py ABunchOfPyFiles.py CompiledCExtensions\ __init__.py ABunchOfExtensions.pyd AdditionalPythonFiles\ __init__.py ABunchOfExtraPythonFiles.py At the moment my setup script boils down to this call: setup (name="Start", version="0.1.0", author="me", excludes="temp", packages= ["Start", "Start.CompiledCExtensions", "Start.AdditionalPythonFiles"] ) I run it as: >>> python setup.py bdist And end up with a zip file containing all the .py (and.pyc) files in the correct structure but no .pyd files. I would rather not have to list each Extension individually. I could probably include the .pyd files as data files using glob, but this seems ugly. I've also tried adding a: ext_modules=[Extension("Start.CompiledCExtensions", [""])] but Extension objects really want some source to build. If I use py2exe to compile a script which depends on this package, it pulls in all the relevant parts just like I want, but of course I end up with an executable rather than a "module distribution", and presumably this would also be useless for Unix builds. I'm guessing there's some easy way to do this which I haven't found yet, so I'd be grateful for any insight. Thanks, mE ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From niki at vintech.bg Tue Sep 21 11:53:49 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue Sep 21 11:54:08 2004 Subject: [python-win32] Distutils and binaries without compilation In-Reply-To: <40E605146701DE428FAF21286A97D3091744B0@wphexa02.corp.lh.int> References: <40E605146701DE428FAF21286A97D3091744B0@wphexa02.corp.lh.int> Message-ID: <414FFA2D.6080307@vintech.bg> Mark English wrote: > The short version of this question is how do you include binaries in a > distribution without including their source ? > [...] > > If I use py2exe to compile a script which depends on this package, it > pulls in all the relevant parts just like I want, but of course I end up > with an executable rather than a "module distribution", and presumably > this would also be useless for Unix builds. I'm guessing there's some > easy way to do this which I haven't found yet, so I'd be grateful for > any insight. What is wrong with python setup.py bdist_wininst? This is what pywin32 uses. HTH Niki Spahiev From pythonmailing at web.de Tue Sep 21 11:53:25 2004 From: pythonmailing at web.de (Marek Kubica) Date: Tue Sep 21 11:54:42 2004 Subject: [python-win32] Detect when an application disappears Message-ID: <20040921115325.00006486@galileo> Hello! I've got such problem: I have an application which is a bit buggy: after closing it is no more in the Tasks section of the Task Manager, but only in the processes and won't die. As the program cannot be changed, do want to kill it some time after it leaves the task section (and hides away from desktop). I do know how to kill it, but I don't know how to detect when it leaves the task panel/becomes invisible. Can somebody help me? greets, Marek From Mark.English at liffe.com Tue Sep 21 14:19:31 2004 From: Mark.English at liffe.com (Mark English) Date: Tue Sep 21 14:19:37 2004 Subject: [python-win32] RE: Python-win32 Digest, Vol 18, Issue 22 Message-ID: <40E605146701DE428FAF21286A97D3091744B1@wphexa02.corp.lh.int> > From: Niki Spahiev > > Mark English wrote: > > The short version of this question is how do you include > binaries in a > > distribution without including their source ? > > > [...] > > > > If I use py2exe to compile a script which depends on this > package, it > > pulls in all the relevant parts just like I want, but of > course I end > > up with an executable rather than a "module distribution", and > > presumably this would also be useless for Unix builds. I'm guessing > > there's some easy way to do this which I haven't found yet, > so I'd be > > grateful for any insight. > > What is wrong with python setup.py bdist_wininst? > This is what pywin32 uses. I still end up with a winzip file (executable) which contains only .py files, and no .pyd files. ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From niki at vintech.bg Tue Sep 21 14:26:56 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue Sep 21 14:27:17 2004 Subject: [python-win32] Re: Python-win32 Digest, Vol 18, Issue 22 In-Reply-To: <40E605146701DE428FAF21286A97D3091744B1@wphexa02.corp.lh.int> References: <40E605146701DE428FAF21286A97D3091744B1@wphexa02.corp.lh.int> Message-ID: <41501E10.3020304@vintech.bg> Mark English wrote: > > >>From: Niki Spahiev >> >>Mark English wrote: >> >>>The short version of this question is how do you include >> >>binaries in a >> >>>distribution without including their source ? >>> >> >>[...] >> >>>If I use py2exe to compile a script which depends on this >> >>package, it >> >>>pulls in all the relevant parts just like I want, but of >> >>course I end >> >>>up with an executable rather than a "module distribution", and >>>presumably this would also be useless for Unix builds. I'm guessing >>>there's some easy way to do this which I haven't found yet, >> >>so I'd be >> >>>grateful for any insight. >> >>What is wrong with python setup.py bdist_wininst? >>This is what pywin32 uses. > > > I still end up with a winzip file (executable) which contains only .py > files, and no .pyd files. When you declare all extension modules distutils will pack them too. Niki Spahiev From cedric.delfosse at linbox.com Tue Sep 21 14:38:14 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Tue Sep 21 14:38:16 2004 Subject: [python-win32] Problem with Excel PrintOut method and pythoncom In-Reply-To: <1095674290.28945.71.camel@replic.metz> References: <1095674290.28945.71.camel@replic.metz> Message-ID: <1095770293.3181.10.camel@replic.metz> Le lun 20/09/2004 ? 11:58, Cedric Delfosse a ?crit : > Hello, > > the behaviour of the PrintOut function seems different according to the > MS Excel version. > The chunk of code I use to print an Excel document into a file is: > > self.doc.PrintOut(PrToFileName = tofile, > ActivePrinter = params['printer'], > PrintToFile = 1) > > This works very well with "Microsoft Office 2000 Premium SR1 French". > The same code with "Microsoft Office XP Pro French" doesn't fail, but > Excel open a window asking the file name to print into !? It should not, > because the PrToFileName argument is already filled with the file name. I've the same problem with "Microsoft Office 2003 Pro French" ... I'm now wondering if someone on this list has successfully used the PrintOut method with python-win32 on Office XP or Office 2003 ? Regards, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From Mark.English at liffe.com Tue Sep 21 17:17:14 2004 From: Mark.English at liffe.com (Mark English) Date: Tue Sep 21 17:17:19 2004 Subject: [python-win32] RE: Distutils and binaries without compilation Message-ID: <40E605146701DE428FAF21286A97D3091744B2@wphexa02.corp.lh.int> > >>Mark English wrote: > >> > >>>The short version of this question is how do you include > >>binaries in a > >>>distribution without including their source ? > >> > >>What is wrong with python setup.py bdist_wininst? > >>This is what pywin32 uses. > > > > > > I still end up with a winzip file (executable) which > contains only .py > > files, and no .pyd files. > > When you declare all extension modules distutils will pack them too. > How do I do that ? How do you "declare all extension modules" ? Even if I explicitly add a module with "modules = ["Start.CompiledCExtensions.ABunchOfExtensions.pyd"] it doesn't work. As I said before if you add it as: ext_modules=[Extension("Start.CompiledCExtensions", [""])] it wants code specified to build it. At the moment I've hacked an extension to py2exe which uses its module and dll finding capabilities to copy across all dependencies (pyd and dll) as data files. ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From Jim.Vickroy at noaa.gov Tue Sep 21 17:41:39 2004 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Sep 21 17:41:44 2004 Subject: [python-win32] unexpected behavior for threaded Windows Service Message-ID: Attached is a "short" script that demonstrates an unexpected behavior of a threaded, producer/consumer, Windows Service. My expectation was that the producer would be queuing events every 2 (producer_pause) seconds while the consumer would be processing queued events every 10 (consumer_pause) seconds. However, the log, generated by this Service, indicates the producer is queuing events at the same frequency as the consumer is processing them. Could someone help me to understand why the producer is not operating independently of the consumer? Thanks, -- jv P.S. My system: Python 2.3.3 pywin build 202 Windows XP -------------- next part -------------- ''' A MSW Service with a producer and a consumer thread connected by a queue. AUTHOR jim.vickroy@noaa.gov ''' import win32serviceutil, win32service, win32event import Queue from thread import start_new_thread from logging import getLogger, shutdown, Logger, FileHandler, Formatter, CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET from time import ctime, sleep, time class Tester(win32serviceutil.ServiceFramework): _svc_name_ = 'Threaded.Services.Tester' _svc_display_name_ = _svc_name_.replace('.', ' ') _svc_deps_ = ['EventLog'] # optional -- names of services to be started before this one consumer_pause = 10 # seconds producer_pause = 2 # seconds def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) # create/configure a logger to record service activities ... self.log = getLogger(self._svc_display_name_) filename = '%s.log' % self._svc_display_name_ recorder = FileHandler(filename) formatter = Formatter('%(asctime)s, %(levelname)-8s, %(message)s') recorder.setLevel(DEBUG) recorder.setFormatter(formatter) self.log.addHandler(recorder) self.log.setLevel(DEBUG) # remaining infrastructure attributes ... self.stop_request = win32event.CreateEvent(None, 0, 0, None) # "stop" request self.events = Queue.Queue() # events to be processed def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # send an acknowledgement to the SCM win32event.SetEvent(self.stop_request) def SvcDoRun(self): start_new_thread(self.producer, ()) # no parameters to pass to the procedure import servicemanager # available only at runtime servicemanager.LogInfoMsg('%s started' % self._svc_display_name_) # record event in Microsoft Windows Application Events Log while not self.shutdown_requested(): while not self.events.empty(): event = self.events.get() self.log.info('consumed "%s"' % event) self.shut_down() def shut_down(self): import servicemanager # available only at runtime servicemanager.LogInfoMsg('%s stopped' % self._svc_display_name_) # record event in Microsoft Windows Application Events Log self.log.info('SHUTDOWN request received') shutdown() def shutdown_requested(self): return win32event.WaitForSingleObject(self.stop_request, self.consumer_pause * 1000) == win32event.WAIT_OBJECT_0 def producer(self): while not self.shutdown_requested(): event = ctime(time()) try: self.events.put(event) except Exception, details: self.log.exception('events queuing failure') else: self.log.info('queued "%s"' % event) sleep(self.producer_pause) if __name__=='__main__': from win32serviceutil import HandleCommandLine HandleCommandLine(Tester) From Jim.Vickroy at noaa.gov Tue Sep 21 23:33:56 2004 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Sep 21 23:34:01 2004 Subject: [python-win32] unexpected behavior for threaded Windows Service In-Reply-To: Message-ID: For those interested, attached is an alternate approach that **does** exhibit the desired behavior. This alternate approach registers a Windows Service Control Handler that responds to a "stop" request rather than periodically checking for a stop event. I'm still curious to know why win32event.WaitForSingleObject(...) appears to pause both (producer and consumer) threads rather than just the consumer thread. -- jv -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Jim Vickroy Sent: Tuesday, September 21, 2004 9:42 AM To: python-win32 Subject: [python-win32] unexpected behavior for threaded Windows Service Attached is a "short" script that demonstrates an unexpected behavior of a threaded, producer/consumer, Windows Service. My expectation was that the producer would be queuing events every 2 (producer_pause) seconds while the consumer would be processing queued events every 10 (consumer_pause) seconds. However, the log, generated by this Service, indicates the producer is queuing events at the same frequency as the consumer is processing them. Could someone help me to understand why the producer is not operating independently of the consumer? Thanks, -- jv P.S. My system: Python 2.3.3 pywin build 202 Windows XP -------------- next part -------------- ''' A MSW Service with a producer and a consumer thread connected by a queue. NOTES o This version + behaves as expected (i.e., producer and consumer threads behave independently of each others pause interval). + uses servicemanager.RegisterServiceCtrlHandler(...) to designate a handler of all MSW Service-related events rather than the win32event.WaitForSingleObject method of polling for a stop request. AUTHOR jim.vickroy@noaa.gov ''' import win32serviceutil, win32service import Queue from thread import start_new_thread from logging import getLogger, shutdown, Logger, FileHandler, Formatter, CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET from time import ctime, sleep, time class Tester(win32serviceutil.ServiceFramework): _svc_name_ = 'Threaded.Services.Tester.version.2' _svc_display_name_ = _svc_name_.replace('.', ' ') _svc_deps_ = ['EventLog'] # optional -- names of services to be started before this one consumer_pause = 10. # seconds producer_pause = 2. # seconds def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) # create/configure a logger to record service activities ... self.log = getLogger(self._svc_display_name_) filename = '%s.log' % self._svc_display_name_ recorder = FileHandler(filename) formatter = Formatter('%(asctime)s, %(levelname)-8s, %(message)s') recorder.setLevel(DEBUG) recorder.setFormatter(formatter) self.log.addHandler(recorder) self.log.setLevel(DEBUG) # remaining infrastructure attributes ... self.events = Queue.Queue() # events to be processed self.stop_received = False def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # send an acknowledgement to the SCM def SvcDoRun(self): start_new_thread(self.producer, ()) # no parameters to pass to the procedure import servicemanager # available only at runtime servicemanager.LogInfoMsg('%s started' % self._svc_display_name_) # record event in Microsoft Windows Application Events Log servicemanager.RegisterServiceCtrlHandler(self._svc_name_, self.service_events_handler) while not self.stop_received: while not self.events.empty(): event = self.events.get() self.log.info('consumed "%s"' % event) for i in range(10): if self.stop_received: break sleep(self.consumer_pause/10) def producer(self): while not self.stop_received: event = ctime(time()) try: self.events.put(event) except Exception, details: self.log.exception('events queuing failure') else: self.log.info('queued "%s"' % event) for i in range(10): if self.stop_received: break sleep(self.producer_pause/10) def service_events_handler(self, operation): ''' a MSW Control Handler Function for use with: servicemanager.RegisterServiceCtrlHandler(self._svc_name_, callback) as the *callback* parameter ''' waitHint = 5000 win32ExitCode = 0 if operation == win32service.SERVICE_CONTROL_PAUSE: # Do whatever it takes to pause here. state = win32service.SERVICE_PAUSED elif operation == win32service.SERVICE_CONTROL_CONTINUE: # Do whatever it takes to continue here. state = win32service.SERVICE_RUNNING elif operation == win32service.SERVICE_CONTROL_STOP: # perform all shutdown tasks import servicemanager # available only at runtime servicemanager.LogInfoMsg('%s stopped' % self._svc_display_name_) # record event in Microsoft Windows Application Events Log state = win32service.SERVICE_STOPPED waitHint = 0 self.ReportServiceStatus(state, waitHint, win32ExitCode) self.log.info('SHUTDOWN request received') shutdown() self.stop_received = True return elif operation == win32service.SERVICE_CONTROL_INTERROGATE: pass else: pass #> 'Unrecognized opcode %d\n' % operation self.ReportServiceStatus(state, waitHint, win32ExitCode) return if __name__=='__main__': from win32serviceutil import HandleCommandLine HandleCommandLine(Tester) From alex at moreati.org.uk Wed Sep 22 01:48:11 2004 From: alex at moreati.org.uk (Alex Willmer) Date: Wed Sep 22 01:49:52 2004 Subject: [python-win32] Mozilla address book and the ever smiling snake In-Reply-To: References: Message-ID: <200409220048.11290.alex@moreati.org.uk> On Monday 20 Sep 2004 14:56, Graeme Glass wrote: > I am trying to access mozilla's address book in a similar manner to > the way one accesses the address book in outlook. > > ie: object = win32com.client.Dispatch("Outlook.Application") > > but it is not wanting to happen for me. If anyone has any ideas, would be > great. > I believe the closest equivalent is PyXPCOM: http://public.activestate.com/pyxpcom/ However I've no experience of it, and it looks (from the docs) as though one must specially compile Mozilla to use it. Regards Alex From mhammond at skippinet.com.au Wed Sep 22 02:24:07 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Sep 22 02:23:52 2004 Subject: [python-win32] unexpected behavior for threaded Windows Service In-Reply-To: Message-ID: <131301c4a03a$87649600$0300a8c0@eden> > I'm still curious to know why > win32event.WaitForSingleObject(...) appears to > pause both (producer and consumer) threads rather than just > the consumer > thread. I don't understand your question - both threads call WaitForSingleObject, so both threads pause. Your producer appears to try and sleep twice - once by virtue of calling self.shutdown_requested() (where is pauses consumer_pause seconds, and once via a direct call to sleep for producer_seconds. I doubt that is what you intended. I suggest you ignore the service part of this. I'm confident that if you constructed the same basic code as a regular Python script, it would do the same thing, and also make it clearer to you what the real issues are. Mark. From mhammond at skippinet.com.au Wed Sep 22 02:32:34 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Sep 22 02:31:58 2004 Subject: [python-win32] Python COM server: can it generate events? In-Reply-To: <4149F8C5.3080009@genarts.com> Message-ID: <131601c4a03b$a7deaf00$0300a8c0@eden> > Is it possible to make a Python COM server which can generate > COM events? I > know how to make attributes and methods, but either I've > missed the event > section in the doc, or maybe it's not possible? > > I'd like to make an asynchronous COM server which can send > events back to > its container (the VB container implements the event handlers, e.g. > OnMyEvent, and that code should run when the Python code calls > "RaiseMyEvent" or whatever). > > Is this possible? It is possible, but no friendly "wrappers" exist. You will probably need to understand how these events actually work (ie, "connection points") and roll your sleeves up. I think you would need to: * Create a typelib describing your event interface, and using win32com\test\pippo*, construct a python server with support for the typelib. (this has no event support) * Look at win32com\demos\connect.py, and add the necessary interfaces to your server to support the connection point dance. connect.py does events, but not from a typelib. * Have your VB code reference this typelib and handle events as normal. If the events you want to raise already are defined in some other typelib, it should be a little easier. Mark. From rogerb at rogerbinns.com Wed Sep 22 07:17:07 2004 From: rogerb at rogerbinns.com (Roger Binns) Date: Wed Sep 22 07:31:02 2004 Subject: [python-win32] Re: Mozilla address book and the ever smiling snake References: <200409220048.11290.alex@moreati.org.uk> Message-ID: Alex Willmer wrote: > I believe the closest equivalent is PyXPCOM: > > http://public.activestate.com/pyxpcom/ > > However I've no experience of it, and it looks (from the docs) as > though one must specially compile Mozilla to use it. I spent several hours trying to work out how to use pyxpcom, and also wanted it for Linux and Mac. I just couldn't see how it could be done without rebuilding some or all of Mozilla, and further issues with binary compatibility etc. COM access to Outlook etc is one thing Microsoft got very right, once you have a language like Python to access it from :-) Roger From jeanfrederic.boisdet at ae.ge.com Wed Sep 22 15:57:38 2004 From: jeanfrederic.boisdet at ae.ge.com (BOISDET, Jean Frederic (GE Transportation, Non-US)) Date: Wed Sep 22 15:57:44 2004 Subject: [python-win32] printer not found Message-ID: <4FE092163984EA49B2BB447325E70D50041DC363@bwfn01msx.ae.ge.com> I am running a basic printing program using reportlab on win2000 professional. When run through pythonwin, the program prints properly. When run through the Apache server, I get a Runtime Error: RuntimeError: The printer was not found. args = ('The printer was not found.',) The printer is a network printer setup for my username. I run the script from the "My Documents/My Website" directory which enables Apache to run as my username. What am I missing? I do need to decide on which printer to print from the server side. Thanks, Jean-Frederic From Paul_S_Johnson at mnb.uscourts.gov Wed Sep 22 23:23:18 2004 From: Paul_S_Johnson at mnb.uscourts.gov (Paul_S_Johnson@mnb.uscourts.gov) Date: Wed Sep 22 23:28:28 2004 Subject: [python-win32] Re: Mozilla address book and the ever smiling snake In-Reply-To: Message-ID: python-win32-bounces@python.org wrote on 09/22/2004 12:17:07 AM: > Alex Willmer wrote: > > I believe the closest equivalent is PyXPCOM: > > > > http://public.activestate.com/pyxpcom/ > > > > However I've no experience of it, and it looks (from the docs) as > > though one must specially compile Mozilla to use it. > > I spent several hours trying to work out how to use pyxpcom, > and also wanted it for Linux and Mac. I just couldn't see > how it could be done without rebuilding some or all of Mozilla, > and further issues with binary compatibility etc. I had a similar experience, set it aside, and then noticed that the author of xpcom had done an update. I tried it again and voila I got it working with binary Firefox as described by the author. However, I haven't had a chance to take it any farther than that. Looked like a significant learning curve learning XPCOM from the ground up especially with not that many learning resource available at present. Very attractive technology, however, open source and cross-platform with tight integration into the whole webby/xml thing. Building XUL apps is definitely on my to do list. Here's one of the coolest examples I've seen to date: http://www.faser.net/mab/ or directly to app: http://www.faser.net/mab/chrome/content/mab.xul (this works only with recent Mozilla or Firefox). -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040922/cd0313fc/attachment.htm From mhammond at skippinet.com.au Thu Sep 23 00:31:06 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Sep 23 00:31:12 2004 Subject: [python-win32] printer not found In-Reply-To: <4FE092163984EA49B2BB447325E70D50041DC363@bwfn01msx.ae.ge.com> Message-ID: <000401c4a0f3$da602e50$030a0a0a@enfoldsystems.local> > I am running a basic printing program using reportlab on win2000 > professional. > When run through pythonwin, the program prints properly. > When run through the Apache server, I get a Runtime Error: > RuntimeError: The printer was not found. > args = ('The printer was not found.',) Apache is probably running as a service using the "local system" account. This account by default has no network access. You could change the account used by apache, but then you may be opening a security hole. Mark From rogerb at rogerbinns.com Thu Sep 23 05:24:47 2004 From: rogerb at rogerbinns.com (Roger Binns) Date: Thu Sep 23 05:24:48 2004 Subject: [python-win32] Re: Re: Mozilla address book and the ever smiling snake References: Message-ID: > I tried it again and voila I got it working with binary Firefox as > described by the author. While what you describe is interesting, I actually want to interoperate with the address book which I think is part of Thunderbird. (I was a very happy user of Mozilla itself until the decided to mostly abandon it in favour of standalone one function programs). Roger From gabor.bekesi at gmail.com Thu Sep 23 09:20:09 2004 From: gabor.bekesi at gmail.com (Bekecs) Date: Thu Sep 23 09:20:12 2004 Subject: [python-win32] Mozilla address book and the ever smiling snake In-Reply-To: <200409220048.11290.alex@moreati.org.uk> References: <200409220048.11290.alex@moreati.org.uk> Message-ID: <54b21f07040923002055a64b45@mail.gmail.com> A pre-compiled version of PyXPCOM can be found at http://www.thomas-schilz.de/MozPython/downloads/ for various versions of Mozilla. Also take a look at its parent page toget info about easy installation steps. The naming is like: PyXPCOM_MozillaVersion_PythonVersion.zip B] On Wed, 22 Sep 2004 00:48:11 +0100, Alex Willmer wrote: > On Monday 20 Sep 2004 14:56, Graeme Glass wrote: > > I am trying to access mozilla's address book in a similar manner to > > the way one accesses the address book in outlook. > > > > ie: object = win32com.client.Dispatch("Outlook.Application") > > > > but it is not wanting to happen for me. If anyone has any ideas, would be > > great. > > > > I believe the closest equivalent is PyXPCOM: > > http://public.activestate.com/pyxpcom/ > > However I've no experience of it, and it looks (from the docs) as though one > must specially compile Mozilla to use it. > > Regards > > Alex > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From gabor.bekesi at gmail.com Thu Sep 23 09:22:13 2004 From: gabor.bekesi at gmail.com (Bekecs) Date: Thu Sep 23 09:22:20 2004 Subject: [python-win32] printer not found In-Reply-To: <000401c4a0f3$da602e50$030a0a0a@enfoldsystems.local> References: <4FE092163984EA49B2BB447325E70D50041DC363@bwfn01msx.ae.ge.com> <000401c4a0f3$da602e50$030a0a0a@enfoldsystems.local> Message-ID: <54b21f070409230022649987b7@mail.gmail.com> ... or may close one. ;-) B] On Thu, 23 Sep 2004 08:31:06 +1000, Mark Hammond wrote: > > I am running a basic printing program using reportlab on win2000 > > professional. > > When run through pythonwin, the program prints properly. > > When run through the Apache server, I get a Runtime Error: > > RuntimeError: The printer was not found. > > args = ('The printer was not found.',) > > Apache is probably running as a service using the "local system" account. > This account by default has no network access. You could change the account > used by apache, but then you may be opening a security hole. > > Mark > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From m.bless at gmx.de Thu Sep 23 11:51:27 2004 From: m.bless at gmx.de (Martin Bless) Date: Thu Sep 23 12:11:02 2004 Subject: [python-win32] Re: Pythonwin vs registry strangeness References: Message-ID: I'm glad I found this thread: Makes me feel I'm not alone and it really helped. Running on WinXP Home, SP2(!); Python 2.3.4; win32 build 202. Here are my observations: (1) It's only been recently that PythonWin rendered unusable. Who's to blame? I'm suspecting its a consequence of applying SP2 for WinXP, but I have no proof. I had all kinds of problems with the startup of PythonWin and its debugger. Some of them seemingly on a random basis. As "Gfeller Martin" wrote, the bug entries at SourceForge give some knowledge: http://sourceforge.net/tracker/?group_id=78018&atid=551954&func=detail&aid=944506 There were really many entries in the debugger section of HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32 (1) I did experiment 1: (a) delete HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32 (b) start PythonWin and step through the debugger. Doing this once created about 20 entries, the second time left about 50 behind ... (2) Experiment 2: (a) delete HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32 (b) In C:/Python23/Lib/site-packages/Pythonwin/pywin/debugger disable line 467 like this: if 0: tb.dialog.SaveState() Experiment 2 seems to be the cure in my case. Have a nice day - happy again mb - Martin Bless From andy at msistone.com Thu Sep 23 21:49:36 2004 From: andy at msistone.com (Andy Shah) Date: Thu Sep 23 22:00:16 2004 Subject: [python-win32] Compile in windows using Microsoft Visual C v. 6 Message-ID: <1ntbb9r01uf1k$.wmuejj0g3zs.dlg@40tude.net> Hello Everybody, I would like to know if where, if any, there is documentation relating to compiling python from source using Microsoft Visual C/C++ v. 6 Kind Regards, Andy. From theller at python.net Thu Sep 23 22:14:58 2004 From: theller at python.net (Thomas Heller) Date: Thu Sep 23 22:15:17 2004 Subject: [python-win32] Re: Compile in windows using Microsoft Visual C v. 6 References: <1ntbb9r01uf1k$.wmuejj0g3zs.dlg@40tude.net> Message-ID: Andy Shah writes: > Hello Everybody, > > I would like to know if where, if any, there is documentation relating to > compiling python from source using Microsoft Visual C/C++ v. 6 The README file and the PCBuild/readme.txt in the source distribution. Thomas From jjl at pobox.com Thu Sep 23 23:03:01 2004 From: jjl at pobox.com (John J Lee) Date: Thu Sep 23 23:03:12 2004 Subject: [python-win32] Re: Compile in windows using Microsoft Visual C v. 6 In-Reply-To: References: <1ntbb9r01uf1k$.wmuejj0g3zs.dlg@40tude.net> Message-ID: On Thu, 23 Sep 2004, Thomas Heller wrote: > Andy Shah writes: > > > Hello Everybody, > > > > I would like to know if where, if any, there is documentation relating to > > compiling python from source using Microsoft Visual C/C++ v. 6 > > The README file and the PCBuild/readme.txt in the source distribution. Just to add: but not in soon-to-be-released 2.4, which has dropped MSVC 6 support (it's still in CVS, but unmaintained). John From xqur4t03 at sneakemail.com Mon Sep 20 22:49:28 2004 From: xqur4t03 at sneakemail.com (Eric) Date: Fri Sep 24 00:50:01 2004 Subject: [python-win32] Dialogs + Menus In-Reply-To: <80150ed604092009435b27dc95@mail.gmail.com> Message-ID: <30313-58366@sneakemail.com> I am new to the list but have been using the python-win32 libraries extensively and with great sucess on a new product (www.imvu.com). I've created several dialog boxes using variations on the demos that ship with pywin32 with great success. What I want to add now is adding menu bars to these windows, which I have not been able to figure out how to do. Does anyone have any suggestions? From garyo at genarts.com Wed Sep 22 15:36:40 2004 From: garyo at genarts.com (Gary Oberbrunner) Date: Fri Sep 24 00:50:02 2004 Subject: [python-win32] Python COM server: can it generate events? In-Reply-To: <131601c4a03b$a7deaf00$0300a8c0@eden> References: <131601c4a03b$a7deaf00$0300a8c0@eden> Message-ID: <41517FE8.1000602@genarts.com> Mark Hammond wrote: > It is possible, but no friendly "wrappers" exist. You will probably need > to understand how these events actually work (ie, "connection points") > and roll your sleeves up. I think you would need to: * Create a typelib > describing your event interface, ... Yow, OK, that's way more than I can do/learn right now. Thanks for the info though! -- Gary O From koliphant at qwest.net Fri Sep 24 03:35:50 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Fri Sep 24 03:32:38 2004 Subject: [python-win32] Dialogs + Menus In-Reply-To: <30313-58366@sneakemail.com> Message-ID: Eric, Use 'win32ui.CreateMenu()' to create a 'PyCMenu' object and use the methods of that object to populate the menu as you wish. Then use the dialog window's 'SetMenu()' method to assign your created menu to the dialog. After that you can put some 'HookCommand()' calls in your dialog 'OnInitDialog()' method to associate the menu ID's with methods in your dialog class. Kerry -----Original Message----- From: python-win32-bounces+koliphant=qwest.net@python.org [mailto:python-win32-bounces+koliphant=qwest.net@python.org]On Behalf Of Eric Sent: Monday, September 20, 2004 2:49 PM To: python-win32@python.org Subject: [python-win32] Dialogs + Menus I am new to the list but have been using the python-win32 libraries extensively and with great sucess on a new product (www.imvu.com). I've created several dialog boxes using variations on the demos that ship with pywin32 with great success. What I want to add now is adding menu bars to these windows, which I have not been able to figure out how to do. Does anyone have any suggestions? _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From m.bless at gmx.de Fri Sep 24 14:16:17 2004 From: m.bless at gmx.de (Martin Bless) Date: Fri Sep 24 14:16:06 2004 Subject: [python-win32] Help! [was: Pythonwin vs registry strangeness] References: Message-ID: I was wrong. The problems are still there. Still on WinXP Home, SP2, Python 2.3.4; win32 build 202. When I start the Debugger (F10) it may happen that immediately 1.200 registry entries like #HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32\ToolbarDebugging-BarNNN or #HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32\ToolbarDebugging-BarNNN are created. I had line 467 in debugger.py disabled like this: if 0: tb.dialog.SaveState() So, this obviously doesn't help. To help myself, I've written this little script that deletes those erroneous entries. Maybe your interested. """Delete problematic registry entries in 'Python for Win32'. Martin Bless, mb, 2004-09-24, 2004-09-24 No warrenties whatsoever. Use at your own risk. """ import win32api import win32con subKey = r'Software\Python 2.3\Python for Win32' if 1: #HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32\ToolbarDebugging-Bar0 k = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,subKey,0,win32con.KEY_ALL_ACCESS) nsubkeys,nvalues,timeval = win32api.RegQueryInfoKey(k) keys = [] for i in range(nsubkeys): s = win32api.RegEnumKey(k,i) if (s.startswith('ToolbarDefault-Bar') or s.startswith('ToolbarDebugging-Bar')): keys.append(s) for i,key in enumerate(keys): subKey2 = subKey + '\\' + key print i,':', subKey2 win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER,subKey2) if i>99999: break k.Close() print len(keys),"deleted." What's going on there? Hope I'm not alone ... Have a nice weekend - sad again. mb - Martin Bless From Mark.English at liffe.com Fri Sep 24 15:57:27 2004 From: Mark.English at liffe.com (Mark English) Date: Fri Sep 24 15:57:31 2004 Subject: [python-win32] Re: Compile in windows using Microsoft Visual C v.6 Message-ID: <40E605146701DE428FAF21286A97D3091480E6@wphexa02.corp.lh.int> > From: John J Lee > On Thu, 23 Sep 2004, Thomas Heller wrote: > > > Andy Shah writes: > > > > > Hello Everybody, > > > > > > I would like to know if where, if any, there is documentation > > > relating to compiling python from source using Microsoft Visual > > > C/C++ v. 6 > > > > The README file and the PCBuild/readme.txt in the source > distribution. > > Just to add: but not in soon-to-be-released 2.4, which has > dropped MSVC 6 support (it's still in CVS, but unmaintained). > > > John Does this mean it's moved to MSVC 7 (or even 7.1) ? Or is MSVC just not going to be supported from now on ? ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From Paul.Moore at atosorigin.com Fri Sep 24 16:06:51 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Fri Sep 24 16:07:02 2004 Subject: [python-win32] Re: Compile in windows using Microsoft Visual C v.6 Message-ID: <16E1010E4581B049ABC51D4975CEDB88052CB4B3@UKDCX001.uk.int.atosorigin.com> From: Mark English > Does this mean it's moved to MSVC 7 (or even 7.1) ? Or is MSVC > just not going to be supported from now on ? Python 2.4 builds will be supported on MSVC 7.1, I believe. MSVC 6 support will not be deleted, but will be unmaintained, and the standard binaries will be built with MSVC 7.1 (and hence most binary extensions will expect a 7.1 runtime, and will be incompatible with a MSVC 6 compiled Python). Paul. __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From bgailer at alum.rpi.edu Fri Sep 24 16:35:20 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Fri Sep 24 16:35:33 2004 Subject: [python-win32] Help! [was: Pythonwin vs registry strangeness] In-Reply-To: References: Message-ID: <6.1.2.0.0.20040924083251.03adb2b8@mail.mric.net> At 06:16 AM 9/24/2004, Martin Bless wrote: >I was wrong. The problems are still there. [snip] >What's going on there? > >Hope I'm not alone ... You are not. There are several outstanding problems with the pythonwin debugger. Most of them just sit in the project's bug list unassigned and unhandled. I for one don't know enough about the debugger code to attempt to fix them. I hope someone does and will. Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From rogerb at rogerbinns.com Fri Sep 24 16:40:19 2004 From: rogerb at rogerbinns.com (Roger Binns) Date: Fri Sep 24 16:40:17 2004 Subject: [python-win32] Re: Mozilla address book and the ever smiling snake References: <200409220048.11290.alex@moreati.org.uk> <54b21f07040923002055a64b45@mail.gmail.com> Message-ID: Bekecs wrote: > The naming is like: PyXPCOM_MozillaVersion_PythonVersion.zip Can you just pick one and have it work with all later versions? Eg if I pick the Moz 1.5 version will it also work with 1.6 and 1.7 as well as Thunderbird? Roger From Mark.English at liffe.com Fri Sep 24 16:42:40 2004 From: Mark.English at liffe.com (Mark English) Date: Fri Sep 24 16:42:51 2004 Subject: [python-win32] Re: Compile in windows using Microsoft Visual C v.6 Message-ID: <40E605146701DE428FAF21286A97D3091480ED@wphexa02.corp.lh.int> Not that you're interested but this is great news, since I was about to backport all my Python C-extensions to VC 6 which would be a real pain. Any timeline on this ? Is there a beta I can build with Vc7 (I don't have any kind of CVS thanks to our firewall) ? Will it include the win32all extensions built too (from building with Vc7 they seemed to need more work, especially PythonWin). Cheers, mE > -----Original Message----- > From: Moore, Paul [mailto:Paul.Moore@atosorigin.com] > Sent: 24 September 2004 15:07 > To: Mark English; python-win32@python.org > Subject: RE: [python-win32] Re: Compile in windows using > Microsoft Visual C v.6 > > > From: Mark English > > > Does this mean it's moved to MSVC 7 (or even 7.1) ? Or is MSVC just > > not going to be supported from now on ? > > Python 2.4 builds will be supported on MSVC 7.1, I believe. > MSVC 6 support will not be deleted, but will be unmaintained, > and the standard binaries will be built with MSVC 7.1 (and > hence most binary extensions will expect a 7.1 runtime, and > will be incompatible with a MSVC 6 compiled Python). > > Paul. ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- From theller at python.net Fri Sep 24 17:09:57 2004 From: theller at python.net (Thomas Heller) Date: Fri Sep 24 17:10:05 2004 Subject: [python-win32] Re: Compile in windows using Microsoft Visual C v.6 References: <40E605146701DE428FAF21286A97D3091480ED@wphexa02.corp.lh.int> Message-ID: "Mark English" writes: > Not that you're interested but this is great news, since I was about to > backport all my Python C-extensions to VC 6 which would be a real pain. > Any timeline on this ? Is there a beta I can build with Vc7 (I don't > have any kind of CVS thanks to our firewall) ? Sources for the 2.4a3 alpha release are available on python.org for download. The first beta is expected in october. > Will it include the > win32all extensions built too (from building with Vc7 they seemed to > need more work, especially PythonWin). You can download the win32all sources as well, no work needed. They should build out of the box with Python 2.4 and MSVC 7.1. Thomas From fguzman_slotown at yahoo.com Fri Sep 24 20:41:18 2004 From: fguzman_slotown at yahoo.com (Fabricio Guzman) Date: Fri Sep 24 20:41:22 2004 Subject: [python-win32] Dialogs + Menus In-Reply-To: <30313-58366@sneakemail.com> Message-ID: <20040924184118.28665.qmail@web11510.mail.yahoo.com> The following functions should help you create menu bars: GetMenu() CreatePopupMenu() AppendMenu() DrawMenuBar() In WinCVS I created an executive (top-most) menu item using the above win32 menu functions with little difficulty. Your biggest hurdle will be finding appropriate CMDIDs for sub-menu items. -Fabricio --- Eric wrote: > I am new to the list but have been using the > python-win32 libraries > extensively and with great sucess on a new product > (www.imvu.com). I've > created several dialog boxes using variations on the > demos that ship with > pywin32 with great success. What I want to add now > is adding menu bars to > these windows, which I have not been able to figure > out how to do. Does > anyone have any suggestions? > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com From blipbeep at gmail.com Sat Sep 25 01:42:29 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sat Sep 25 01:42:35 2004 Subject: [python-win32] PythonWin - docking and completion Message-ID: <934895d0040924164250785829@mail.gmail.com> Hi, I've been using PythonWin for a bit, and I think it's great. I would like the MDI windows to be docking though (as well as things like the trace collector). Is there a trick to make them dockable? Also, what is the trick for completion and sanity checks. I know that Python is not strongly typed :-), but it would be nice to see that I'm referencing some module that I forgot to import. It would also be nice to get all the completion for a module (like some of the Win32 COM objects). What are the tricks? If there aren't any, has anyone thought of improvements? beepboop From mhammond at skippinet.com.au Sat Sep 25 02:34:15 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Sep 25 02:34:34 2004 Subject: [python-win32] PythonWin - docking and completion In-Reply-To: <934895d0040924164250785829@mail.gmail.com> Message-ID: <01c601c4a297$6b2cb530$0300a8c0@enfoldsystems.local> > I've been using PythonWin for a bit, and I think it's great. > I would like the MDI windows to be docking though (as well as things > like the trace collector). Is there a trick to make them dockable? Dockable windows in MFC have totally thrown me :) I don't want to think about how many hours it took to make the interactive window dockable and stable.. After that, I just couldn't find the energy. > Also, what is the trick for completion and sanity checks. I know that > Python is not > strongly typed :-), but it would be nice to see that I'm > referencing some > module that I forgot to import. It would also be nice to get > all the completion > for a module (like some of the Win32 COM objects). Completion is very simple - see the pywin\idle directory. sanity checks are largely non-existant - Scintilla itself does some basic indentation checks, and "Ctrl+Shift+C" checks the syntax is OK (which as you say, doesn't tell you alot in Python. > What are the tricks? If there aren't any, has anyone thought > of improvements? Plenty of ideas for improvements, just short on time to do them. It is very rare that I get time to spend on pythonwin these days, and given MFC is basically dead, it has no "strategic" interest to people. Hopefully some one else will step up to the plate and start offering contributions. Mark. From droux at tuks.co.za Sat Sep 25 17:12:08 2004 From: droux at tuks.co.za (Danie Roux) Date: Sat Sep 25 17:15:22 2004 Subject: [python-win32] Returning objects from COM Message-ID: <20040925151200.GA4879@link.up.ac.za> I don't know COM at all, and fter spending a few hours being confused by this, I hope someone have an answer for me: How do I return a custom Python object from a COM server? All examples and literature I find only allows me to return primitive types. Basically I want this to work: o = win32com.client.Dispatch("MyOwnObject.Name") " person is a complex object of type Person person = o.getPerson("John Doe") print person.getName() -- Danie Roux *shuffle* Adore Unix From blipbeep at gmail.com Sun Sep 26 05:26:35 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sun Sep 26 05:26:39 2004 Subject: [python-win32] Returning objects from COM In-Reply-To: <20040925151200.GA4879@link.up.ac.za> References: <20040925151200.GA4879@link.up.ac.za> Message-ID: <934895d0040925202610f706c0@mail.gmail.com> The short anwer... you probably can't. COM returns primitive types OR other objects. You could return another IDispatch object (it's not a python obj), and then you could get properties from it. This object would be a COM object and could be written in C++ or Python. example: o = win32com.client.Dispatch("MyOwnObject.Name") person = o.getPerson("John Doe") print person.Name print person.UserID ..etc.. On Sat, 25 Sep 2004 17:12:08 +0200, Danie Roux wrote: > I don't know COM at all, and fter spending a few hours being confused by > this, I hope someone have an answer for me: > > How do I return a custom Python object from a COM server? All examples and > literature I find only allows me to return primitive types. > > Basically I want this to work: > > o = win32com.client.Dispatch("MyOwnObject.Name") > " person is a complex object of type Person > person = o.getPerson("John Doe") > print person.getName() > > -- > Danie Roux *shuffle* Adore Unix > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From blipbeep at gmail.com Sun Sep 26 05:28:42 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sun Sep 26 05:28:45 2004 Subject: [python-win32] How do I get a PyIMAPIProps ? Message-ID: <934895d004092520282c66320c@mail.gmail.com> Lets say I have a PyUnknown. I've been trying to QueryInterface for and IID, but it is failing. That got me looking around. Where are the objects that the mapi module creates. It only exposes the main functions, but not the objects from what I can tell from dir() From mhammond at skippinet.com.au Mon Sep 27 05:49:12 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Sep 27 05:49:21 2004 Subject: [python-win32] How do I get a PyIMAPIProps ? In-Reply-To: <934895d004092520282c66320c@mail.gmail.com> Message-ID: <05c101c4a444$f46e57a0$0300a8c0@enfoldsystems.local> > Lets say I have a PyUnknown. I've been trying to > QueryInterface for and IID, but it is failing. If the error code is E_NOINTERFACE, then you are querying an object for an interface that it doesn't support. > That got me looking around. Where are the objects > that the mapi module creates. It only exposes > the main functions, but not the objects from what I > can tell from dir() Most of the other objects are returned by method calls etc. See "demos/mapisend.py" at: http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/com/win32comext/mapi/d emos/ SpamBayes (www.spambayes.org) is written in Python and makes extensive use of MAPI Mark. From mhammond at skippinet.com.au Mon Sep 27 05:50:18 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Sep 27 05:50:47 2004 Subject: [python-win32] Returning objects from COM In-Reply-To: <20040925151200.GA4879@link.up.ac.za> Message-ID: <05cc01c4a445$285f00f0$0300a8c0@enfoldsystems.local> > I don't know COM at all, and fter spending a few hours being > confused by > this, I hope someone have an answer for me: > > How do I return a custom Python object from a COM server? All > examples and > literature I find only allows me to return primitive types. > > Basically I want this to work: > > o = win32com.client.Dispatch("MyOwnObject.Name") > " person is a complex object of type Person > person = o.getPerson("John Doe") > print person.getName() You need to use win32com.server.util.wrap(). To get 'debugging' support for these objects, pass 'useDispatcher=1' as a keyword param - this object will then operate just like CoCreated objects registered with '--debug'. Mark. From niki at vintech.bg Mon Sep 27 09:58:40 2004 From: niki at vintech.bg (Niki Spahiev) Date: Mon Sep 27 09:58:53 2004 Subject: [python-win32] PythonWin - docking and completion In-Reply-To: <01c601c4a297$6b2cb530$0300a8c0@enfoldsystems.local> References: <01c601c4a297$6b2cb530$0300a8c0@enfoldsystems.local> Message-ID: <4157C830.6000806@vintech.bg> Mark Hammond wrote: > Plenty of ideas for improvements, just short on time to do them. It is very > rare that I get time to spend on pythonwin these days, and given MFC is > basically dead, it has no "strategic" interest to people. Hopefully some > one else will step up to the plate and start offering contributions. Some small improvements from me are waiting in SF patch area. Niki Spahiev From lehmanap at cs.purdue.edu Tue Sep 28 01:41:19 2004 From: lehmanap at cs.purdue.edu (Aaron Patrick Lehmann) Date: Tue Sep 28 01:41:25 2004 Subject: [python-win32] Creating a Profile programmatically. Message-ID: <20040927234119.GA10775@lore.cs.purdue.edu> Hello-- I've been using exchange e-mail proiles to Logon( )to Exchange MAPI Sessions. Now I would like to create the Profile programmatically, instead of clicking through the Mail stuff, and have them be persistent across executions of the program. I would also like to be able to list the profiles that are available. Are these things possible? If so, how? Aaron Lehmann -- Sometimes you stay the course; Sometimes the course stays you. From mhammond at skippinet.com.au Tue Sep 28 03:17:59 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 28 03:18:10 2004 Subject: [python-win32] Creating a Profile programmatically. In-Reply-To: <20040927234119.GA10775@lore.cs.purdue.edu> Message-ID: <000f01c4a4f8$feebd6d0$0300a8c0@enfoldsystems.local> > I've been using exchange e-mail proiles to Logon( )to Exchange MAPI Sessions. > Now I would like to create the Profile programmatically, instead of clicking > through the Mail stuff, and have them be persistent across executions of the Below is some code that should work. Python simply wraps most of these MAPI functions - so your best best is to find the C++ sample code provided by MS - especially the 'exchange' and 'exchdapi' ones, such as HrCreateProfileName(). You should even be able to find the MS C++ source to those "Hr" functions, so see how it can be done at the raw MAPI level. Depending on your app, you may or may not need a "mailbox agent". Mark. ret = exchange.HrCreateProfileName(profileName) # Attempt to delete the existing profile. try: exchdapi.HrRemoveProfile(profileName) except pythoncom.error: pass # Occasionally MAPI takes some time to catch up - eg, if this code # is running from a service and not explicitly marked dependent on # Exchange, Exchange itself may still be starting. # You may need to add this code in a loop that handles failure and # retries. try: exchdapi.HrCreateMailboxAgentProfile(yourProgramName, ret) except pythoncom.com_error, (hr, desc, exc, arg): if hr == winerror.E_ACCESSDENIED: # the profile exists, and is in use - just use it. pass else: # all other errors are real errors. raise return ret From blipbeep at gmail.com Tue Sep 28 08:37:37 2004 From: blipbeep at gmail.com (Alias Alias) Date: Tue Sep 28 08:37:41 2004 Subject: [python-win32] How do I get a PyIMAPIProps ? In-Reply-To: <05c101c4a444$f46e57a0$0300a8c0@enfoldsystems.local> References: <934895d004092520282c66320c@mail.gmail.com> <05c101c4a444$f46e57a0$0300a8c0@enfoldsystems.local> Message-ID: <934895d004092723375e095bf0@mail.gmail.com> When I queryinterface for the IMAPIProps or IMessage interfaces, it returns with an error saying that there isn't an object registered to handle the object. > If the error code is E_NOINTERFACE, then you are querying an object for an > interface that it doesn't support. From mhammond at skippinet.com.au Tue Sep 28 09:13:23 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Sep 28 09:13:30 2004 Subject: [python-win32] How do I get a PyIMAPIProps ? In-Reply-To: <934895d004092723375e095bf0@mail.gmail.com> Message-ID: <004301c4a52a$a51ae830$040a0a0a@enfoldsystems.local> > When I queryinterface for the IMAPIProps or IMessage > interfaces, it returns > with an error saying that there isn't an object registered to > handle the > object. What is the exact error and code? You must have imported win32com.mapi.mapi before the QI will work (but presumably you have to get those IIDs). Check out http://cvs.sourceforge.net/viewcvs.py/spambayes/spambayes/Outlook2000/sandbo x/ for some fully functioning utilities which work with these interfaces. I believe the mapi_send sample I pointed you at before also uses these interfaces. Mark From robert.d.hogan at aib.ie Tue Sep 28 10:35:57 2004 From: robert.d.hogan at aib.ie (Robert Hogan) Date: Tue Sep 28 10:36:04 2004 Subject: [python-win32] DDE Timeouts Message-ID: <00f501c4a536$2cf46e10$5103200a@b5665gx150800> Hi there, I'm using Python's DDE with IBM OnDemand. As you can imagine queries often take a little while to return, so pythonwin's DDE hardcoded timeout of 5 seconds in stddde.cpp is just not enough. At the moment I'm using 'try: except:' to work around it but I would prefer to increase the timeout. I don't have MSVC at work or home so I can't rebuild myself. Does anyone have a build where the timeout is say > 50 secs? Also, why is the timeout so low in the default build? Thanks, Robert ******************************************************************************** This document is strictly confidential and is intended for use by the addressee unless otherwise indicated. This email has been scanned by an external Email Security System. Allied Irish Banks ******************************************************************************** From AddisonN at iti-ab.com Tue Sep 28 12:11:59 2004 From: AddisonN at iti-ab.com (AddisonN@iti-ab.com) Date: Tue Sep 28 12:13:39 2004 Subject: [python-win32] XP sp2 Problem? Message-ID: <9355218C54DDFF4CA43FC31AEB6FB0EC2C6435@iti00-exc01.iti.arabbank.plc> I just installed XP sp2 (I know, I know...) and since then when I close my PythonWin session it always terminates with a Visual C++ Runtime Library Error - "This application has requested the Runtime to terminate in an unusual way." Has anyone else seen this? I was on Py2.3.4 and then I installed 2.4a3 (with the appropriate PyWin 202 build). ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. Information Technology International (ITI) +44 (0)20 7315 8500 ********************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040928/962f8d4d/attachment.htm From shayanr at sjsoft.com Tue Sep 28 14:31:49 2004 From: shayanr at sjsoft.com (Shayan Raghavjee) Date: Tue Sep 28 14:32:01 2004 Subject: [python-win32] Adding attachments to extended MAPI messages Message-ID: <415959B5.8060809@sjsoft.com> Hi, I'm trying to extend David Fraser & Stephen Emslie's extended MAPI code to include attachments, but with not much success. It looks like CreateAttachment returns a list with an attachment number and a pyAttach object. I've been trying to add the desired properties to the pyAttach object using it SetProps method, as it's done in the message itself. In the end, I get an unnamed attachment, with some of the data I put in, except the character's been changed to something else, (But that may be because of the way I'm reading the file perhaps?) All the other properties seem to be ignored, and aren't there if I examine the message with something like OutlookSpy. I've included the test code I'm trying, does anyone have any ideas? Thanks, Shayan Raghavjee St. James Software -------------- next part -------------- #!/usr/bin/env python """module to send mail with Extended MAPI using the pywin32 mapi wrappers...""" # this was based on Jason Hattingh's C++ code at http://www.codeproject.com/internet/mapadmin.asp # written by David Fraser and Stephen Emslie # you can test this by changing the variables at the bottom and running from the command line from win32com.mapi import mapi from win32com.mapi import mapitags # Pre 2.2.1 compat. try: True, False except NameError: True = 1==1; False = 1==0 def SendEMAPIMail(Subject="", Message="", SendTo=None, SendCC=None, SendBCC=None, MAPIProfile=None): """Sends an email to the recipient using the extended MAPI interface Subject and Message are strings Send{To,CC,BCC} are comma-separated address lists MAPIProfile is the name of the MAPI profile""" # initialize and log on mapi.MAPIInitialize(None) session = mapi.MAPILogonEx(0, MAPIProfile, None, mapi.MAPI_EXTENDED | mapi.MAPI_USE_DEFAULT) messagestorestable = session.GetMsgStoresTable(0) messagestorestable.SetColumns((mapitags.PR_ENTRYID, mapitags.PR_DISPLAY_NAME_A, mapitags.PR_DEFAULT_STORE),0) while (True): rows = messagestorestable.QueryRows(1, 0) if len(rows) != 1: break row = rows[0] propertyid, propertyvalue = row[0] if (propertyid == mapitags.PR_DEFAULT_STORE and propertyvalue == True): break # unpack the row and open the message store (eid_tag, eid), (name_tag, name), (def_store_tag, def_store) = row msgstore = session.OpenMsgStore(0,eid,None,mapi.MDB_NO_DIALOG | mapi.MAPI_BEST_ACCESS) # get the outbox hr, props = msgstore.GetProps((mapitags.PR_IPM_OUTBOX_ENTRYID), 0) (tag, eid) = props[0] outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS) # create the message and the addrlist message = outboxfolder.CreateMessage(None,0) # note: you can use the resolveaddress functions for this. but you may get headaches pal = [] def makeentry(recipient, recipienttype): return ((mapitags.PR_RECIPIENT_TYPE, recipienttype), (mapitags.PR_SEND_RICH_INFO, False), (mapitags.PR_DISPLAY_TYPE, 0), (mapitags.PR_OBJECT_TYPE, 6), (mapitags.PR_EMAIL_ADDRESS_A, recipient), (mapitags.PR_ADDRTYPE_A, 'SMTP'), (mapitags.PR_DISPLAY_NAME_A, recipient)) if SendTo: pal.extend([makeentry(recipient, mapi.MAPI_TO) for recipient in SendTo.split(",")]) if SendCC: pal.extend([makeentry(recipient, mapi.MAPI_CC) for recipient in SendCC.split(",")]) if SendBCC: pal.extend([makeentry(recipient, mapi.MAPI_BCC) for recipient in SendBCC.split(",")]) # add the resolved recipients to the message message.ModifyRecipients(mapi.MODRECIP_ADD,pal) f = open('c:\\nexsig.gif') iAttach = message.CreateAttach(None,0) iAttach[1].SetProps([ (mapitags.PR_ATTACH_METHOD, mapi.ATTACH_BY_VALUE), (mapitags.PR_ATTACH_LONG_FILENAME, 'test.gif'), (mapitags.PR_ATTACH_FILENAME, 'test.gif'), (mapitags.PR_ATTACH_EXTENSION, '.gif'), (mapitags.PR_ATTACH_NUM, iAttach[0]), (mapitags.PR_DISPLAY_NAME, 'test.gif'), (mapitags.PR_ATTACH_DATA_BIN, f.read()), ]) f.close() iAttach[1].SaveChanges(0) message.SetProps([(mapitags.PR_BODY_A,Message), (mapitags.PR_SUBJECT_A,Subject)]) # save changes and submit outboxfolder.SaveChanges(0) message.SubmitMessage(0) def test(): MAPIProfile = "mail.sjsoft.com" SendTo = "shayan@telkomsa.net" SendCC = "shayanr@sjsoft.com" SendBCC = None SendMessage = "testing one two three" # SendSubject = "Testing Simple MAPI!!" # SendMAPIMail(SendSubject, SendMessage, SendTo, MAPIProfile=MAPIProfile) SendSubject = "Testing Extended MAPI!!" print SendSubject SendEMAPIMail(SendSubject, SendMessage, SendTo, MAPIProfile=MAPIProfile) if __name__ == '__main__': MAPIProfile = "" # Change this to a valid email address to test SendTo = "an.invalid at address" SendMessage = "testing one two three" SendSubject = "Testing Extended MAPI!!" SendEMAPIMail(SendSubject, SendMessage, SendTo, MAPIProfile=MAPIProfile) From graemeglass at gmail.com Tue Sep 28 16:52:02 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Tue Sep 28 16:52:04 2004 Subject: [python-win32] ActiveSheets and excel Message-ID: When dispatching your own instance of excel, it is pretty straight forward to access the workbook and ActiveSheets by way of the Excel.Application object, in this case exapp. eg: exapp = win32com.client.Dispatch("Excel.Application") exapp.Visible = 1 exapp.Workbooks.Add() exapp.ActiveSheet.Cells(1,1).Value = 'hello' my question is, how does one add, remove workbooks, and access ActiveSheets from with excel by means of an Addin? I have been attempting to access it throught what i thought was the application interface in the plugin but it is not :-) So i currently stand with a plugin button that can bring up message boxes and frames but not do anything really usefull. Any help would be very much appreciated. Thanks, Graeme From fguzman_slotown at yahoo.com Tue Sep 28 17:14:35 2004 From: fguzman_slotown at yahoo.com (Fabricio Guzman) Date: Tue Sep 28 17:14:38 2004 Subject: [python-win32] ActiveSheets and excel In-Reply-To: Message-ID: <20040928151435.73714.qmail@web11503.mail.yahoo.com> The "exapp" object is available to the user once the the plug-in attaches itself to excel through the OnConnection callback method of the IDTExtensibility2 interface. It is in the callback's first argument, usally called "application" of type Object. Once you have a reference to this object you can manip excel as you wish. Hope this helps. -Fabricio --- Graeme Glass wrote: > When dispatching your own instance of excel, it is > pretty straight > forward to access the workbook and ActiveSheets by > way of the > Excel.Application object, in this case exapp. > eg: > > exapp = > win32com.client.Dispatch("Excel.Application") > exapp.Visible = 1 > exapp.Workbooks.Add() > exapp.ActiveSheet.Cells(1,1).Value = 'hello' > > my question is, how does one add, remove workbooks, > and access > ActiveSheets from with excel by means of an Addin? I > have been > attempting to access it throught what i thought was > the application > interface in the plugin but it is not :-) > So i currently stand with a plugin button that can > bring up message > boxes and frames but not do anything really usefull. > Any help would be > very much appreciated. > > Thanks, Graeme > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail From robert.d.hogan at aib.ie Wed Sep 29 09:32:55 2004 From: robert.d.hogan at aib.ie (Robert Hogan) Date: Wed Sep 29 09:33:10 2004 Subject: [python-win32] DDE Timeouts References: <00f501c4a536$2cf46e10$5103200a@b5665gx150800> <934895d004092811443aaa0c1b@mail.gmail.com> Message-ID: <004901c4a5f6$89772040$5103200a@b5665gx150800> > what is IBM OnDemand? mmm... it's not really relevant to the question, which could relate to any app that takes longer than 5 seconds to respond to a dde request. But I'm sure google would reward your curiosity... > > > On Tue, 28 Sep 2004 09:35:57 +0100, Robert Hogan wrote: > > Hi there, > > > > I'm using Python's DDE with IBM OnDemand. As you can imagine queries often > > take a little while to return, so pythonwin's DDE hardcoded timeout of 5 > > seconds in stddde.cpp is just not enough. At the moment I'm using 'try: > > except:' to work around it but I would prefer to increase the timeout. I > > don't have MSVC at work or home so I can't rebuild myself. Does anyone have > > a build where the timeout is say > 50 secs? > > > > Also, why is the timeout so low in the default build? > > > > Thanks, > > Robert > > > > **************************************************************************** **** > > This document is strictly confidential and is intended for use by > > the addressee unless otherwise indicated. > > > > This email has been scanned by an external Email Security System. > > > > Allied Irish Banks > > **************************************************************************** **** > > > > _______________________________________________ > > Python-win32 mailing list > > Python-win32@python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > From davidf at sjsoft.com Wed Sep 29 09:46:27 2004 From: davidf at sjsoft.com (David Fraser) Date: Wed Sep 29 09:46:36 2004 Subject: [python-win32] Mozilla address book and the ever smiling snake In-Reply-To: References: Message-ID: <415A6853.2090708@sjsoft.com> Graeme Glass wrote: >I am trying to access mozilla's address book in a similar manner to >the way one accesses the address book in outlook. > >ie: object = win32com.client.Dispatch("Outlook.Application") > >but it is not wanting to happen for me. If anyone has any ideas, would be great. > >Thanks, Graeme > Hi Graeme There was a message on the Chandler mailing list about this: http://lists.osafoundation.org/pipermail/dev/2004-February/001224.html Which points to this (the link in the actual mail is incorrect): http://wiki.osafoundation.org/twiki/bin/viewauth/Jungle/MozillaMailStatus The PyConnect info is here: http://wiki.osafoundation.org/bin/view/Jungle/MozMailStatus0 An alternative approach would be to read the address book file directly. See http://mail.python.org/pipermail/python-list/2004-July/230770.html for an email that doesn't tell you how to do it :-) Or http://www.tcs.informatik.uni-muenchen.de/~abel/mozab2pine/ for something that uses Awk All in all, it doesn't look easy... David From richard.eibrand at propylon.com Wed Sep 29 10:39:59 2004 From: richard.eibrand at propylon.com (Richard Eibrand) Date: Wed Sep 29 10:40:06 2004 Subject: [python-win32] EventLog Parsing Message-ID: Hi All, My first foray into the world of python, and I'm liking it ;-) I have to write a prog to monitor the windows event log files, and that in itself is not a problem for the three standard EventLog files (Application, Security and System). The thing is that I do not have access to the machine I am writting the app for, so I got a copy of the event files and loaded it into the mmc. What I'd like to do, is to read the new event file that was loaded into the mmc via using the python app that I'm writting, any ideas/thoughts/suggestions whether this is possible or not? All the best, Richard From graemeglass at gmail.com Wed Sep 29 12:26:24 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Wed Sep 29 12:26:29 2004 Subject: [python-win32] win32com, excel and wx Message-ID: In the demo excelAddin (\Lib\site-packages\win32com\demos), a win32ui.MessageBox is used. I was wondering is it/would it be possible to use wx instead of win32ui? I have tried but with no sucsess. Have a great day. Graeme From graemeglass at gmail.com Wed Sep 29 12:34:36 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Wed Sep 29 12:34:39 2004 Subject: [python-win32] ActiveSheets and excel In-Reply-To: References: <20040928151435.73714.qmail@web11503.mail.yahoo.com> Message-ID: I have been playing around with the "application" Object but with no joy. How am i able to find out what methods are available to the "application" object? I have been looking in the msdn and google but only seem to be able to find things that pertain to what i can do with a dispatched object ie(o= win32com.client.Dispatch("Excel.Application") From graemeglass at gmail.com Wed Sep 29 17:02:59 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Wed Sep 29 17:03:05 2004 Subject: [python-win32] ActiveSheets and excel In-Reply-To: References: <20040928151435.73714.qmail@web11503.mail.yahoo.com> Message-ID: I found documentation for this (FINALY) look up info on "Application Object" that is returned by the OnConnection method. It is in the MSDN and im sure on the net. Hope this saves some one else a couple of hours someday. :-) On Wed, 29 Sep 2004 12:34:36 +0200, Graeme Glass wrote: > I have been playing around with the "application" Object but with no joy. > > How am i able to find out what methods are available to the > "application" object? > I have been looking in the msdn and google but only seem to be able to > find things that pertain to what i can do with a dispatched object > ie(o= win32com.client.Dispatch("Excel.Application") > From tim.golden at viacom-outdoor.co.uk Wed Sep 29 17:09:58 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Sep 29 17:14:24 2004 Subject: [python-win32] ActiveSheets and excel Message-ID: | I found documentation for this (FINALY) look up info on "Application | Object" that is returned by the OnConnection method. | It is in the MSDN and im sure on the net. | Hope this saves some one else a couple of hours someday. | :-) | | | On Wed, 29 Sep 2004 12:34:36 +0200, Graeme Glass | wrote: | > I have been playing around with the "application" Object | but with no joy. | > | > How am i able to find out what methods are available to the | > "application" object? | > I have been looking in the msdn and google but only seem to | be able to | > find things that pertain to what i can do with a dispatched object | > ie(o= win32com.client.Dispatch("Excel.Application") Don't know if this is exactly what you're after, but if win32com.client has generated a proxy module for a COM object, you can either look at the module in your gen_py directory (eg c:\python23\lib\site-packages\gen_py) or you can simply run help on the corresponding class. This has the slight advantage of showing you *in Python terms* what parameters are expected. import win32com.client xl = win32com.client.gencache.EnsureDispatch ("Excel.Application") help (xl.__class__) 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 ________________________________________________________________________ From Martin.Gfeller at comit.ch Wed Sep 29 19:48:08 2004 From: Martin.Gfeller at comit.ch (Gfeller Martin) Date: Wed Sep 29 19:48:12 2004 Subject: [python-win32] XP sp2 Problem? Message-ID: I have not seen this with Py 2.3.3 / PyWin 202 on XP SP2; Python and Zope work just fine. However, I have received the same message once or twice from MS Outlook after upgrading to XP SP2. Best regards, Martin -----Original Message----- From: AddisonN@iti-ab.com [mailto:AddisonN@iti-ab.com] Sent: Tuesday, September 28, 2004 12:12 PM To: python-win32@python.org Subject: [python-win32] XP sp2 Problem? I just installed XP sp2 (I know, I know...) and since then when I close my PythonWin session it always terminates with a Visual C++ Runtime Library Error - "This application has requested the Runtime to terminate in an unusual way." Has anyone else seen this? I was on Py2.3.4 and then I installed 2.4a3 (with the appropriate PyWin 202 build). From mhammond at skippinet.com.au Thu Sep 30 01:01:35 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Sep 30 01:01:49 2004 Subject: [python-win32] EventLog Parsing In-Reply-To: Message-ID: <05e501c4a678$457a3620$040a0a0a@enfoldsystems.local> win32evtlog.OpenBackupEventLog() exists. The official MSDN docs appear to say this can only be used to perform a backup, but that makes no sense. Other MS docs say the handle returned can be used by ReadEventLog etc. I've never tried it though. Mark. > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au@python.org > [mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org]On > Behalf Of Richard Eibrand > Sent: Wednesday, 29 September 2004 6:40 PM > To: python-win32@python.org > Subject: [python-win32] EventLog Parsing > > > Hi All, > > My first foray into the world of python, and I'm liking it ;-) > > I have to write a prog to monitor the windows event log > files, and that in > itself is not a problem for the three standard EventLog files > (Application, Security and System). The thing is that I do > not have access > to the machine I am writting the app for, so I got a copy of > the event > files and loaded it into the mmc. > > What I'd like to do, is to read the new event file that was > loaded into > the mmc via using the python app that I'm writting, any > ideas/thoughts/suggestions whether this is possible or not? > > All the best, > > Richard > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Thu Sep 30 01:02:52 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Sep 30 01:03:00 2004 Subject: [python-win32] win32com, excel and wx In-Reply-To: Message-ID: <05f401c4a678$734c67d0$040a0a0a@enfoldsystems.local> > In the demo excelAddin (\Lib\site-packages\win32com\demos), a > win32ui.MessageBox is used. I was wondering is it/would it be possible > to use wx instead of win32ui? For simple message boxes, win32gui should expose all you need and avoids MFC etc. I believe wx has some support for Python and COM, but I don't know any details. Mark From b_papadopoulos at iris.gr Thu Sep 30 07:51:02 2004 From: b_papadopoulos at iris.gr (Bill Papadopoulos) Date: Thu Sep 30 07:56:33 2004 Subject: [python-win32] MSWord: Server Busy Message-ID: <003d01c4a6b1$785560e0$2700000a@themeliodomi> I do some MSWord programming -if i may call it this way- through Python. I am doing well so far, but the first time I set a margin to a Word document I get a "server busy" message which floads away after ~15 secs. This occurs only to the first Word document that i open. If i open a second Word document this "server busy" message will no longer appear. After lots of search and tests I have concluded that i must set the clsctx parameter to my Dispatch object which I created in order for my script to wait until the Word Automation Server is initialized. I do the Dispatch as follows: wordApp = Dispatch("Word.Application") But, I think i must do it like this: wordApp = Dispatch("Word.Application", clsctx = [clsctx value] ) I have found some values that clsctx accepts (such as: CLSCTX_INPROC_HANDLER = 2 ) but when I set them to the Dispatch (example: Dispatch("Word.Application", clsctx = 2) I get a "No such interface supported". So, my question, is there any proper way to make my script wait until the Word Automation Server is initialized to avoid getting the "Server Busy" error message? p.s.This "Server Busy" error message only appears in Win98. Best Regards Vax ____________________ b_papadopoulos@iris.gr vax@cls.gr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040930/3b47a7d6/attachment.htm From b_papadopoulos at iris.gr Thu Sep 30 08:54:07 2004 From: b_papadopoulos at iris.gr (Bill Papadopoulos) Date: Thu Sep 30 08:59:45 2004 Subject: [python-win32] win32com, excel and wx Message-ID: <009a01c4a6ba$4816d400$2700000a@themeliodomi> Graeme, try this import wx dlg = wx.MessageDialog(None, "Window Message", "Head Message") a = dlg.ShowModal() Its like your win32ui.MessageBox, like win32api.MessageBox Vax ____________________ b_papadopoulos@iris.gr vax@cls.gr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040930/5d686ce3/attachment.html From mc at mclaveau.com Thu Sep 30 10:15:48 2004 From: mc at mclaveau.com (Michel Claveau) Date: Thu Sep 30 10:15:55 2004 Subject: [python-win32] MSWord: Server Busy References: <003d01c4a6b1$785560e0$2700000a@themeliodomi> Message-ID: <01e901c4a6c5$b34cf5f0$0701a8c0@PORTABLES> Hi ! "server busy" c'est souvent du au temps de lancement de ms-word "server busy" it's often because ms-word is slow to begin to run. Ajoute/Add "time.sleep(5)" Michel Claveau From niki at vintech.bg Thu Sep 30 10:38:19 2004 From: niki at vintech.bg (Niki Spahiev) Date: Thu Sep 30 10:38:26 2004 Subject: [python-win32] win32com, excel and wx In-Reply-To: <009a01c4a6ba$4816d400$2700000a@themeliodomi> References: <009a01c4a6ba$4816d400$2700000a@themeliodomi> Message-ID: <415BC5FB.10707@vintech.bg> Bill Papadopoulos wrote: > Graeme, try this > > import wx > > dlg = wx.MessageDialog(None, "Window Message", "Head Message") > > a = dlg.ShowModal() > > Its like your win32ui.MessageBox, like win32api.MessageBox > Its easy to show wx window first time. Second and third are usually the hard part. Niki Spahiev From b_papadopoulos at iris.gr Thu Sep 30 10:32:50 2004 From: b_papadopoulos at iris.gr (Bill Papadopoulos) Date: Thu Sep 30 10:38:59 2004 Subject: [python-win32] MSWord: Server Busy Message-ID: <00dd01c4a6c8$125755c0$2700000a@themeliodomi> >>Hi ! >>"server busy" c'est souvent du au temps de lancement de ms-word >> "server busy" it's often because ms-word is slow to begin to run. >>Ajoute/Add "time.sleep(5)" >>Michel Claveau Hello Michael and thank your for responding, This is what I do before I get the "Server Busy" message: #Setting TopMargin wordApp.ActiveDocument.PageSetup.TopMargin = 5 where wordApp is my Dispatch object. I 've already tried time.sleep() after setting the Margin which resulted to a "server busy" message and then the script "slept". Also, I tried time.sleep() before setting the Margin which resulted to make the script wait and then to get the "server busy" message. I need something like: while waiting for margin to be set: time.sleep() Any suggestions? Anyway, thanks again! Vax ____________________ b_papadopoulos@iris.gr vax@cls.gr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040930/68bdfa89/attachment.html From fguzman_slotown at yahoo.com Thu Sep 30 18:24:06 2004 From: fguzman_slotown at yahoo.com (Fabricio Guzman) Date: Thu Sep 30 18:24:09 2004 Subject: [python-win32] MSWord: Server Busy In-Reply-To: <00dd01c4a6c8$125755c0$2700000a@themeliodomi> Message-ID: <20040930162406.61230.qmail@web11507.mail.yahoo.com> How about trapping the error with a try block: bWorked = false while bWorked == false try wordApp.ActiveDocument.PageSetup.TopMargin = 5 bWorked = true catch it's not pretty but it will try and try until the server is finished initializing. -Fabricio --- Bill Papadopoulos wrote: > > >>Hi ! > > >>"server busy" c'est souvent du au temps de > lancement de ms-word > >> "server busy" it's often because ms-word is slow > to begin to run. > >>Ajoute/Add "time.sleep(5)" > >>Michel Claveau > > > Hello Michael and thank your for responding, > > This is what I do before I get the "Server Busy" > message: > > #Setting TopMargin > wordApp.ActiveDocument.PageSetup.TopMargin = 5 > > where wordApp is my Dispatch object. > > > I 've already tried time.sleep() after setting the > Margin which resulted > to a "server busy" message and then the script > "slept". > > Also, I tried time.sleep() before setting the Margin > which resulted > to make the script wait and then to get the "server > busy" message. > > I need something like: > > while waiting for margin to be set: > time.sleep() > > Any suggestions? > Anyway, thanks again! > > > Vax > ____________________ > b_papadopoulos@iris.gr > vax@cls.gr > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail From graemeglass at gmail.com Thu Sep 30 22:09:43 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Thu Sep 30 22:09:55 2004 Subject: [python-win32] accessing application object from OnConnection method in another Class Message-ID: If you look at the example demo "ExcelAddin" that come with win32all, def OnConnection(self, application, connectMode, addin, custom): self.appHostApp = application btnMyButton = self.toolbarButton = DispatchWithEvents(btnMyButton, ButtonEvent) the OnConnection method gets an instance of "application" , it also registers btnMyButton to call the class ButtonEvent when the button is click. My question is how can i pass a refrence of "application" to ButtonEvent class so that it can access "application" when the button is click? I have tried ever way i can think of: ie: btnMyButton = self.toolbarButton = DispatchWithEvents(btnMyButton, ButtonEvent(ref)) self.appHostApp = application self.appHostApp(ref) btnMyButton = self.toolbarButton = DispatchWithEvents(btnMyButton, ButtonEvent(self.appHostApp)) to name a few. I have also spent some time in the MSDN and Google and still am confused. Have ordered Marks book "Python programming on win32" but it will only be here in 10 days (i count the minutes). so if anyone has any ideas in the interim, would be very much appreciated. Thanks, Graeme