From jcasale at activenetwerx.com Wed Jan 1 00:40:53 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Tue, 31 Dec 2013 23:40:53 +0000 Subject: [python-win32] Canonical ordering of an ACL Message-ID: I can't seem to find any info on the PyACL methods that modify an ACL as to whether or not they enforce canonical ordering, I hate assume but given the role of some of the methods it does look it would need to? Thanks, jlc From rupole at hotmail.com Wed Jan 1 01:47:09 2014 From: rupole at hotmail.com (Roger Upole) Date: Tue, 31 Dec 2013 19:47:09 -0500 Subject: [python-win32] Canonical ordering of an ACL References: Message-ID: See function _ReorderACL in PyACL.cpp: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/file/90d1d37b2444/win32/src/PyACL.cpp Roger "Joseph L. Casale" wrote in message news:assp.0077d9e4c1.e9def4441d094aa091d586758fbd34ff at exch.activenetwerx.com... >I can't seem to find any info on the PyACL methods that modify an ACL as to > whether or not they enforce canonical ordering, I hate assume but given the > role of some of the methods it does look it would need to? > > Thanks, > jlc From rupole at hotmail.com Wed Jan 1 02:06:05 2014 From: rupole at hotmail.com (Roger Upole) Date: Tue, 31 Dec 2013 20:06:05 -0500 Subject: [python-win32] Setting ownership and permissions References: Message-ID: You should be able to just adjust privs once, instead of doing it in each call for every file. Roger "Joseph L. Casale" wrote in message news:assp.006455fdda.50f65708cf40439eba7f2abd9c2d85a0 at exch.activenetwerx.com... >I have a situation where I need to remove large directories and in doing so I must take ownership. > I get a stack trace about the logon I impersonate generating to many security ids as I recursively > iterate and take ownership. > > What workarounds have you guys utilized in this scenario? > > I suspect there is room for optimizing the approach I am using, where I pass the sid of the new > owner in to this function that leverages the unc path in self.unc: > > def owner_set(self, owner_sid): > new_privs = ( > (win32security.LookupPrivilegeValue( > '', ntsecuritycon.SE_RESTORE_NAME), > win32con.SE_PRIVILEGE_ENABLED), > (win32security.LookupPrivilegeValue( > '', ntsecuritycon.SE_TAKE_OWNERSHIP_NAME), > win32con.SE_PRIVILEGE_ENABLED)) > > thread = win32api.GetCurrentThread() > handle = win32security.OpenThreadToken( > thread, win32security.TOKEN_ALL_ACCESS > | win32con.TOKEN_ADJUST_PRIVILEGES > | win32con.TOKEN_IMPERSONATE, False) > win32security.AdjustTokenPrivileges(handle, 0, new_privs) > > fs = win32security.GetFileSecurity( > self.unc, win32security.OWNER_SECURITY_INFORMATION) > fs.SetSecurityDescriptorOwner(owner_sid, True) > > win32security.SetFileSecurity( > self.unc, win32security.OWNER_SECURITY_INFORMATION, fs) > > Thanks, > jlc From mhysnm1964 at gmail.com Wed Jan 1 07:52:06 2014 From: mhysnm1964 at gmail.com (Sean Murphy) Date: Wed, 1 Jan 2014 17:52:06 +1100 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: <52C323D1.3030808@probo.com> References: <52C323D1.3030808@probo.com> Message-ID: <0B6E31A7-D543-46CC-900B-532A971D63C7@gmail.com> All, thanks for the information. I will look into it. In relation to Tim's comment. The reason why I want to stick to Win32 API's is because I am blind. The screen reader which allows me to use the computer does not work with Xwindow style widgets. They have to be native Windows style objects. That is the challenge I have in front of me in finding a GUI library that works with my screen reader. I do have some knowledge of Event driven, OOPS programming. But it is very basic and normally I use other peoples codes. :-) I am in the middle of writing a Telnet app to send a huge config to my router which is one of my learning steps. :-) Sean On 01/01/2014, at 7:06 AM, Tim Roberts wrote: > Sean Murphy wrote: >> I am very very new to Python. I have read the book on programming for Windows with Python that was released in 2000. The book is very good but doesn't give me the basic information I am seeking. Since I am a beginner programmer. > > I want to caution you that you have an awful lot of fundamental concepts > to get down before you're ready to tackle something like this. You have > to learn the Python language, which means learning the concepts of > class-based and object-oriented programming. After getting > straight-line programming, you'll have to learn the concepts of > event-driven programming, which is the paradigm used by all of the > modern GUIs. Then, you'll need to learn the idiosyncracies of whatever > GUI library you choose, all of which make compromises to mate with the > variations in the operating systems they support. > > >> I want to create a GUI windows app with Python. The program has to use default Windows 32 or 64 bit objects. > > I'm curious to know what you meant by that. Do you simply mean you > don't want to buy any components? Because essentially all of the major > Python GUI toolkits have their own library of components that are vastly > simpler to use than the SDK components. > > If you REALLY just want to write an MFC program in Python, it's possible > to do that using pywin32, but it's not really very Python-like. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 From jacob at blindza.co.za Wed Jan 1 12:26:47 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 1 Jan 2014 13:26:47 +0200 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: <0B6E31A7-D543-46CC-900B-532A971D63C7@gmail.com> References: <52C323D1.3030808@probo.com> <0B6E31A7-D543-46CC-900B-532A971D63C7@gmail.com> Message-ID: Sean, I am also what some of us refer to as a blindie, and, AFAIK, wxPython is roundabout the best framework to make use of for use/compatibility with screen readers/MSAA, and, while have in past primarily used the LBC (layoub by code) wxPython wrapper module to quickly generate simple/small UI's, I am now trying to get going using wxPython properly/itself. If I may ask, what do you use to edit your python code, etc.? I use edSharp, which is a sort of blind programmers text editor, created by Jamal Masry - if tht name means much to you. Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: "Sean Murphy" To: "Tim Roberts" Cc: Sent: Wednesday, January 01, 2014 08:52 AM Subject: Re: [python-win32] Win32 GUI for beginners. > All, > > thanks for the information. I will look into it. In relation to Tim's > comment. The reason why I want to stick to Win32 API's is because I am > blind. The screen reader which allows me to use the computer does not work > with Xwindow style widgets. They have to be native Windows style objects. > > That is the challenge I have in front of me in finding a GUI library that > works with my screen reader. > > I do have some knowledge of Event driven, OOPS programming. But it is very > basic and normally I use other peoples codes. :-) > > I am in the middle of writing a Telnet app to send a huge config to my > router which is one of my learning steps. :-) > > Sean > On 01/01/2014, at 7:06 AM, Tim Roberts wrote: > >> Sean Murphy wrote: >>> I am very very new to Python. I have read the book on programming for >>> Windows with Python that was released in 2000. The book is very good but >>> doesn't give me the basic information I am seeking. Since I am a >>> beginner programmer. >> >> I want to caution you that you have an awful lot of fundamental concepts >> to get down before you're ready to tackle something like this. You have >> to learn the Python language, which means learning the concepts of >> class-based and object-oriented programming. After getting >> straight-line programming, you'll have to learn the concepts of >> event-driven programming, which is the paradigm used by all of the >> modern GUIs. Then, you'll need to learn the idiosyncracies of whatever >> GUI library you choose, all of which make compromises to mate with the >> variations in the operating systems they support. >> >> >>> I want to create a GUI windows app with Python. The program has to use >>> default Windows 32 or 64 bit objects. >> >> I'm curious to know what you meant by that. Do you simply mean you >> don't want to buy any components? Because essentially all of the major >> Python GUI toolkits have their own library of components that are vastly >> simpler to use than the SDK components. >> >> If you REALLY just want to write an MFC program in Python, it's possible >> to do that using pywin32, but it's not really very Python-like. >> >> -- >> Tim Roberts, timr at probo.com >> Providenza & Boekelheide, Inc. >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From esj at harvee.org Wed Jan 1 20:09:49 2014 From: esj at harvee.org (Eric S. Johansson) Date: Wed, 01 Jan 2014 14:09:49 -0500 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: <0B6E31A7-D543-46CC-900B-532A971D63C7@gmail.com> References: <52C323D1.3030808@probo.com> <0B6E31A7-D543-46CC-900B-532A971D63C7@gmail.com> Message-ID: <52C467FD.8050107@harvee.org> On 1/1/2014 1:52 AM, Sean Murphy wrote: > All, > > thanks for the information. I will look into it. In relation to Tim's comment. The reason why I want to stick to Win32 API's is because I am blind. The screen reader which allows me to use the computer does not work with Xwindow style widgets. They have to be native Windows style objects. > > That is the challenge I have in front of me in finding a GUI library that works with my screen reader. I'm in a similar position. I'm disabled (hands) and use speech recognition. Naturally speaking plays nice with some windows edit controls and not any of the other "non standard" edit controls (Nuances's language, not mine). > > I do have some knowledge of Event driven, OOPS programming. But it is very basic and normally I use other peoples codes. :-) I'm a little more advanced on programming but am hampered by the learning curve of windows documentation. a bit of interactive mentoring would go a long way. > > I am in the middle of writing a Telnet app to send a huge config to my router which is one of my learning steps. :-) I may be able to help with that some. I'm making the same type of tool using ssh. most not-yet-disabled people will find how we work rather strange. :-) --- eric From torriem at gmail.com Thu Jan 2 05:04:49 2014 From: torriem at gmail.com (Michael Torrie) Date: Wed, 01 Jan 2014 21:04:49 -0700 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: References: Message-ID: <52C4E561.60504@gmail.com> On 12/31/2013 11:26 AM, Heang Lim wrote: > 2. When you convert your guiApp.ui into guiApp.py, it creates a Python > class (e.g Ui_Test_Automation for my apps) with widget objects you need to > call to trigger widget actions/signals. You will need to look into > guiApp.py Python script to learn to use the objects it creates for various > widgets/buttons, drop-down menu, etc. For instance, if you create a push > button called RUN_TESTS, pyuic4 will create something like the following: > > class Ui_Test_Automation(object): > def setupUi(self, Test_Automation): > self.RUN_TESTS=QtGui.QPushButton(Test_Automation) > .... Hmm, don't you just use the PyQT.uic api to load the ui file directly into your running program? Seems a lot more flexible and easier than having to generate code each time the ui file changes. http://www.chrisevans3d.com/pub_blog/?p=468 From jcasale at activenetwerx.com Thu Jan 2 16:35:05 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Thu, 2 Jan 2014 15:35:05 +0000 Subject: [python-win32] Setting ownership and permissions In-Reply-To: References: <50f65708cf40439eba7f2abd9c2d85a0@exch.activenetwerx.com>, Message-ID: > You should be able to just adjust privs once, instead of doing it in each call for every file. I blame the holiday distractions for not arriving there myself, thanks Roger. jlc From jcasale at activenetwerx.com Thu Jan 2 16:33:57 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Thu, 2 Jan 2014 15:33:57 +0000 Subject: [python-win32] Canonical ordering of an ACL In-Reply-To: References: , Message-ID: > See function _ReorderACL in PyACL.cpp: > > http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/file/90d1d37b2444/win32/src/PyACL.cpp Thanks Roger, jlc From heang.s.lim at gmail.com Thu Jan 2 17:56:14 2014 From: heang.s.lim at gmail.com (Heang Lim) Date: Thu, 2 Jan 2014 09:56:14 -0700 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: <52C4E561.60504@gmail.com> References: <52C4E561.60504@gmail.com> Message-ID: I have never used PyQT.uic api before. Thanks for the suggestion and the link. I have to look into it. -Heang On Wed, Jan 1, 2014 at 9:04 PM, Michael Torrie wrote: > On 12/31/2013 11:26 AM, Heang Lim wrote: > > 2. When you convert your guiApp.ui into guiApp.py, it creates a Python > > class (e.g Ui_Test_Automation for my apps) with widget objects you need > to > > call to trigger widget actions/signals. You will need to look into > > guiApp.py Python script to learn to use the objects it creates for > various > > widgets/buttons, drop-down menu, etc. For instance, if you create a push > > button called RUN_TESTS, pyuic4 will create something like the following: > > > > class Ui_Test_Automation(object): > > def setupUi(self, Test_Automation): > > self.RUN_TESTS=QtGui.QPushButton(Test_Automation) > > .... > > Hmm, don't you just use the PyQT.uic api to load the ui file directly > into your running program? Seems a lot more flexible and easier than > having to generate code each time the ui file changes. > > http://www.chrisevans3d.com/pub_blog/?p=468 > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From breamoreboy at yahoo.co.uk Mon Jan 6 17:59:54 2014 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Mon, 06 Jan 2014 16:59:54 +0000 Subject: [python-win32] clicking pyw file gives me a console Message-ID: As the subject :( It only happens if I've a shebang line at the top of the file, remove that and the file is launched without the console. If I add a w to the end of python on the shebang line I get a dialog box "Python launcher is sorry to say ... Invalid version specification: 'w'" I've 2.7, 3.3 and now the latest version of 3.4 installed on Windows 7. How do I go about debugging this? Section 3.4.1.3. of the "Using Python on Windows" docs simply state "The launcher should have been associated with Python files (i.e. .py, .pyw, .pyc, .pyo files) when it was installed". Below are the file types and associations which look fine to me. Python.CompiledFile="C:\Windows\py.exe" "%1" %* Python.File="C:\Windows\py.exe" "%1" %* Python.NoConFile="C:\Windows\pyw.exe" "%1" %* .py=Python.File .pyc=Python.CompiledFile .pyo=Python.CompiledFile .pyw=Python.NoConFile -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence From mail at timgolden.me.uk Wed Jan 8 16:16:38 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 08 Jan 2014 15:16:38 +0000 Subject: [python-win32] clicking pyw file gives me a console In-Reply-To: References: Message-ID: <52CD6BD6.9070109@timgolden.me.uk> On 06/01/2014 16:59, Mark Lawrence wrote: > As the subject :( It only happens if I've a shebang line at the top of > the file, remove that and the file is launched without the console. If > I add a w to the end of python on the shebang line I get a dialog box > "Python launcher is sorry to say ... Invalid version specification: > 'w'" I've 2.7, 3.3 and now the latest version of 3.4 installed on > Windows 7. How do I go about debugging this? Section 3.4.1.3. of the > "Using Python on Windows" docs simply state "The launcher should have > been associated with Python files (i.e. .py, .pyw, .pyc, .pyo files) > when it was installed". > > Below are the file types and associations which look fine to me. > > Python.CompiledFile="C:\Windows\py.exe" "%1" %* > Python.File="C:\Windows\py.exe" "%1" %* > Python.NoConFile="C:\Windows\pyw.exe" "%1" %* > > .py=Python.File > .pyc=Python.CompiledFile > .pyo=Python.CompiledFile > .pyw=Python.NoConFile Mark -- does this happen only if you double-click or also if you run the file from the command line? By that I mean somthing like: c:\users\tim> myfile.py I ask because the Shell/Explorer (the program handling the double-click) has its own association mechanism. Usually it matches the settings you list above, but it doesn't have to. TJG From breamoreboy at yahoo.co.uk Wed Jan 8 18:04:31 2014 From: breamoreboy at yahoo.co.uk (Mark Lawrence) Date: Wed, 08 Jan 2014 17:04:31 +0000 Subject: [python-win32] clicking pyw file gives me a console In-Reply-To: <52CD6BD6.9070109@timgolden.me.uk> References: <52CD6BD6.9070109@timgolden.me.uk> Message-ID: On 08/01/2014 15:16, Tim Golden wrote: > On 06/01/2014 16:59, Mark Lawrence wrote: >> As the subject :( It only happens if I've a shebang line at the top of >> the file, remove that and the file is launched without the console. If >> I add a w to the end of python on the shebang line I get a dialog box >> "Python launcher is sorry to say ... Invalid version specification: >> 'w'" I've 2.7, 3.3 and now the latest version of 3.4 installed on >> Windows 7. How do I go about debugging this? Section 3.4.1.3. of the >> "Using Python on Windows" docs simply state "The launcher should have >> been associated with Python files (i.e. .py, .pyw, .pyc, .pyo files) >> when it was installed". >> >> Below are the file types and associations which look fine to me. >> >> Python.CompiledFile="C:\Windows\py.exe" "%1" %* >> Python.File="C:\Windows\py.exe" "%1" %* >> Python.NoConFile="C:\Windows\pyw.exe" "%1" %* >> >> .py=Python.File >> .pyc=Python.CompiledFile >> .pyo=Python.CompiledFile >> .pyw=Python.NoConFile > > Mark -- does this happen only if you double-click or also if you run the > file from the command line? By that I mean somthing like: > > c:\users\tim> myfile.py > > I ask because the Shell/Explorer (the program handling the double-click) > has its own association mechanism. Usually it matches the settings you > list above, but it doesn't have to. > > > TJG Just tried again and working perfectly, please don't ask. Thinking about it I have been un- and re-installing 2.7, 3.3 and 3.4 so could well have caused some kind of problem there. Sorry about the noise :( -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence From mail at timgolden.me.uk Wed Jan 8 18:21:22 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 08 Jan 2014 17:21:22 +0000 Subject: [python-win32] clicking pyw file gives me a console In-Reply-To: References: <52CD6BD6.9070109@timgolden.me.uk> Message-ID: <52CD8912.7000105@timgolden.me.uk> On 08/01/2014 17:04, Mark Lawrence wrote: > On 08/01/2014 15:16, Tim Golden wrote: >> On 06/01/2014 16:59, Mark Lawrence wrote: >>> As the subject :( It only happens if I've a shebang line at the top of >>> the file, remove that and the file is launched without the console. If >>> I add a w to the end of python on the shebang line I get a dialog box >>> "Python launcher is sorry to say ... Invalid version specification: >>> 'w'" I've 2.7, 3.3 and now the latest version of 3.4 installed on >>> Windows 7. How do I go about debugging this? Section 3.4.1.3. of the >>> "Using Python on Windows" docs simply state "The launcher should have >>> been associated with Python files (i.e. .py, .pyw, .pyc, .pyo files) >>> when it was installed". >>> >>> Below are the file types and associations which look fine to me. >>> >>> Python.CompiledFile="C:\Windows\py.exe" "%1" %* >>> Python.File="C:\Windows\py.exe" "%1" %* >>> Python.NoConFile="C:\Windows\pyw.exe" "%1" %* >>> >>> .py=Python.File >>> .pyc=Python.CompiledFile >>> .pyo=Python.CompiledFile >>> .pyw=Python.NoConFile >> >> Mark -- does this happen only if you double-click or also if you run the >> file from the command line? By that I mean somthing like: >> >> c:\users\tim> myfile.py >> >> I ask because the Shell/Explorer (the program handling the double-click) >> has its own association mechanism. Usually it matches the settings you >> list above, but it doesn't have to. >> >> >> TJG > > Just tried again and working perfectly, please don't ask. Thinking > about it I have been un- and re-installing 2.7, 3.3 and 3.4 so could > well have caused some kind of problem there. Sorry about the noise :( > Ok, thanks for letting us know; chalk it up to "one of those things" :) TJG From jacob at blindza.co.za Fri Jan 10 08:49:24 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Fri, 10 Jan 2014 09:49:24 +0200 Subject: [python-win32] Alternatives for 'compiling' python code into .exe Message-ID: <788D1A20A91344E888256264E5208FE2@JakesPC> Working with python 2.7, and along with trying to implement a larger, scrolling panel, making use of wx.lib.scrolledpanel.ScrolledPanel, using wxPython 3.0, py2exe no longer seems able to 'compile' code into working .exe files for use on windows - the error message below is generated into the .log file when I try to execute the app thereafter: Traceback (most recent call last): File "sizerExperiment4.py", line 2, in File "zipextimporter.pyo", line 82, in load_module File "wx\__init__.pyo", line 45, in File "zipextimporter.pyo", line 82, in load_module File "wx\_core.pyo", line 125, in AttributeError: 'module' object has no attribute 'PROCESS_ENTER' Is there an alternative to py2exe I can try making use of? TIA Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Fri Jan 10 15:29:08 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Fri, 10 Jan 2014 16:29:08 +0200 Subject: [python-win32] Alternatives for 'compiling' python code into .exe In-Reply-To: <788D1A20A91344E888256264E5208FE2@JakesPC> References: <788D1A20A91344E888256264E5208FE2@JakesPC> Message-ID: <4A442EF65BA84E8D8DAE80E71E17B701@JakesPC> OK, another update - took, and modified a slightly different version of the setup.py for py2exe that includes packaging MS runtime files/DLL's in library.zip, etc., and .exe output now seems to work, but anyway... Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: Jacob Kruger To: python-win32 at python.org Sent: Friday, January 10, 2014 09:49 AM Subject: [python-win32] Alternatives for 'compiling' python code into .exe Working with python 2.7, and along with trying to implement a larger, scrolling panel, making use of wx.lib.scrolledpanel.ScrolledPanel, using wxPython 3.0, py2exe no longer seems able to 'compile' code into working .exe files for use on windows - the error message below is generated into the .log file when I try to execute the app thereafter: Traceback (most recent call last): File "sizerExperiment4.py", line 2, in File "zipextimporter.pyo", line 82, in load_module File "wx\__init__.pyo", line 45, in File "zipextimporter.pyo", line 82, in load_module File "wx\_core.pyo", line 125, in AttributeError: 'module' object has no attribute 'PROCESS_ENTER' Is there an alternative to py2exe I can try making use of? TIA Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ------------------------------------------------------------------------------ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From khoroshyy at gmail.com Fri Jan 10 15:26:56 2014 From: khoroshyy at gmail.com (Khoroshyy Petro) Date: Fri, 10 Jan 2014 15:26:56 +0100 Subject: [python-win32] Access coclass interface? Message-ID: <20140110142655.GA3439@gmail.com> Hi list, I try to control a setup which consist of a monochromator and a CCD camera. I have no bid problems with CCD camera, it works pretty well via Dispatch ... WinspecApp = win32com.Dispatchh("WinX32.WinX32App") ... Here is Win32App CoClass from gen.py file class Winx32App(CoClass): u"Roper Scientific's Winx32App Class" _reg_clsid_ = GUID('{675DA983-188A-11D1-9330-444553540000}') _idlflags_ = ['appobject'] _typelib_path_ = typelib_path _reg_typelib_ = ('{1A762221-D8BA-11CF-AFC2-508201C10000}', 3, 12) Winx32App._com_interfaces_ = [IWinx32App2, IWinx32App] # values for enumeration 'ExpSaveOpts' EXPAS_BAD = 0 EXPAS_PROMPT = 1 EXPAS_AUTO = 2 EXPAS_NOSAVE = 3 ExpSaveOpts = c_int # enum # values for enumeration 'PRC_PARAM' PRC_OUTFILENAME = 1 PRC_AUTOSAVE = 2 PRC_FILEACCESS = 3 PRC_FILEINCCOUNT = 4 PRC_FILEINCENABLE = 5 PRC_NEWWINDOW = 6 PRC_OVERWRITECONFIRM = 7 PRC_RUNNING = 8 PRC_DISPLAYOUTPUT = 9 PRC_PARAM = c_int # enum Now if I try to access a monochromator coclass from another libray in the same way I get com_error: (-2147221005. instrument = win32com.client.Dispatch("JYMONOLib.IJYMonoReqd") or instrument = win32com.client.Dispatch("JYMONOLib.Monochromator") Here is gen file: # -*- coding: mbcs -*- typelib_path = u'C:\\Program Files\\Jobin Yvon\\Common\\JY Components\\Monos\\JYMono\\JYMono.dll' _lcid = 0 # change this if required from ctypes import * import comtypes.gen._638F5A15_35A6_4F7D_B8ED_B48A4CD4C619_0_1_0 from comtypes import GUID from comtypes import CoClass class Library(object): u'JYMono 1.0 Type Library' name = u'JYMONOLib' _reg_typelib_ = ('{D7E942DC-3716-4BC1-8DA2-08D273BDC501}', 1, 0) class Monochromator(CoClass): u'Monochromator Class' _reg_clsid_ = GUID('{BFF968D4-7B20-4D16-BD3A-BDEFEB0863A4}') _idlflags_ = [] _typelib_path_ = typelib_path _reg_typelib_ = ('{D7E942DC-3716-4BC1-8DA2-08D273BDC501}', 1, 0) Monochromator._com_interfaces_ = [comtypes.gen._638F5A15_35A6_4F7D_B8ED_B48A4CD4C619_0_1_0.IJYMonoReqd] Monochromator._outgoing_interfaces_ = [comtypes.gen._638F5A15_35A6_4F7D_B8ED_B48A4CD4C619_0_1_0._IJYDeviceReqdEvents] __all__ = ['Monochromator'] from comtypes import _check_version; _check_version('501') I need somehow to access IJYMonoReqd interface Could anybody give me a hint about what I am doing wrong? Thanks. Petro From theller at ctypes.org Fri Jan 10 19:51:57 2014 From: theller at ctypes.org (Thomas Heller) Date: Fri, 10 Jan 2014 19:51:57 +0100 Subject: [python-win32] Access coclass interface? In-Reply-To: <20140110142655.GA3439@gmail.com> References: <20140110142655.GA3439@gmail.com> Message-ID: Am 10.01.2014 15:26, schrieb Khoroshyy Petro: > Hi list, > I try to control a setup which consist of a monochromator and a CCD camera. [...] > > Now if I try to access a monochromator coclass from another libray in > the same way I get com_error: (-2147221005. > instrument = win32com.client.Dispatch("JYMONOLib.IJYMonoReqd") > or > instrument = win32com.client.Dispatch("JYMONOLib.Monochromator") You can use ctypes.WinError to look up the error code if it known to windows: >>> from ctypes import * >>> raise WinError(-2147221005) Traceback (most recent call last): File "", line 1, in WindowsError: [Error -2147221005] Ung?ltige Klassenzeichenfolge >>> In english this would read: 'Invalid class string'. This means that the COM runtime does not know about the "JYMONOLib.IJYMonoReqd" and "JYMONOLib.Monochromator" names. Thomas From khoroshyy at gmail.com Mon Jan 13 14:04:00 2014 From: khoroshyy at gmail.com (Khoroshyy Petro) Date: Mon, 13 Jan 2014 14:04:00 +0100 Subject: [python-win32] Access coclass interface? In-Reply-To: References: <20140110142655.GA3439@gmail.com> Message-ID: <20140113130359.GA3550@gmail.com> Thank you to your respond. I looked into the library I need using OLE explorer. At the and of my message I paste the intormation I got from there. Could anybody give me a tip how to access IJYMonoReqd interface. Thank you in advance Petro -------------- // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: JYMono.dll [ uuid(D7E942DC-3716-4BC1-8DA2-08D273BDC501), version(1.0), helpstring("JYMono 1.0 Type Library"), custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 83951780), custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1181570652) ] library JYMONOLib { // TLib : // TLib : JYSystemLib 1.0 Type Library : // {638F5A15-35A6-4F7D-B8ED-B48A4CD4C619} importlib("JYSystemLib.dll"); // Forward declare all types defined in this // typelib [ uuid(BFF968D4-7B20-4D16-BD3A-BDEFEB0863A4), helpstring("Monochromator Class") ] coclass Monochromator { [default] interface IJYMonoReqd; [default, source] dispinterface _IJYDeviceReqdEvents; }; }; ------------------------------------------------------- [ uuid(BFF968D4-7B20-4D16-BD3A-BDEFEB0863A4), helpstring("Monochromator Class") ] coclass Monochromator { [default] interface IJYMonoReqd; [default, source] dispinterface _IJYDeviceReqdEvents; }; ------------------------------------------------------------------ [ uuid(7963F672-D074-4F67-B15C-AF022065927E), helpstring("IJYMonoReqd Interface"), dual ] dispinterface IJYMonoReqd { properties: methods: [id(0x00000001), helpstring("Method Load")] void Load(); [id(0x00000002), helpstring("Method Save")] void Save(); [id(0x00000003), helpstring("Method OpenCommunicationsEx")] void OpenCommunicationsEx( [in] jyCommType __MIDL_0016, [in] int portNum, [in, optional] ....... ________________________________________________________________________ On Fri, Jan 10, 2014 at 07:51:57PM +0100, Thomas Heller wrote: > Am 10.01.2014 15:26, schrieb Khoroshyy Petro: > >Hi list, > >I try to control a setup which consist of a monochromator and a CCD camera. > [...] > > > >Now if I try to access a monochromator coclass from another libray in > >the same way I get com_error: (-2147221005. > >instrument = win32com.client.Dispatch("JYMONOLib.IJYMonoReqd") > >or > >instrument = win32com.client.Dispatch("JYMONOLib.Monochromator") > > > You can use ctypes.WinError to look up the error code if it known > to windows: > > >>> from ctypes import * > >>> raise WinError(-2147221005) > Traceback (most recent call last): > File "", line 1, in > WindowsError: [Error -2147221005] Ung?ltige Klassenzeichenfolge > >>> > > In english this would read: 'Invalid class string'. > > This means that the COM runtime does not know about the > "JYMONOLib.IJYMonoReqd" and "JYMONOLib.Monochromator" names. > > Thomas > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 From jcasale at activenetwerx.com Fri Jan 17 00:21:54 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Thu, 16 Jan 2014 23:21:54 +0000 Subject: [python-win32] Removing inheritance Message-ID: How does one accomplish the effect of the SetAccessRuleProtection call? I am trying to take an existing DACL and remove inheritance so parent changes are not inherited unless the child objects are reset. I can iterate a dacl and remove an inherited ace which is in my opinion technically invalid as any parent change will simply resolve the intermittent state. Without disabling inheritance on the object itself, I am not clear on the proper approach. Any guidance would be greatly appreciated. jlc From rupole at hotmail.com Fri Jan 17 22:15:53 2014 From: rupole at hotmail.com (Roger Upole) Date: Fri, 17 Jan 2014 16:15:53 -0500 Subject: [python-win32] Removing inheritance References: Message-ID: You can call win32security.SetNamedSecurityInfo with PROTECTED_DACL_SECURITY_INFORMATION to prevent inheritance. Roger "Joseph L. Casale" wrote in message news:cc848ab27fe14b629765c0700254766f at exch.activenetwerx.com... > How does one accomplish the effect of the SetAccessRuleProtection call? I am trying to > take an existing DACL and remove inheritance so parent changes are not inherited unless > the child objects are reset. > > I can iterate a dacl and remove an inherited ace which is in my opinion technically invalid > as any parent change will simply resolve the intermittent state. Without disabling inheritance > on the object itself, I am not clear on the proper approach. > > Any guidance would be greatly appreciated. > jlc From jcasale at activenetwerx.com Sat Jan 18 18:29:14 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Sat, 18 Jan 2014 17:29:14 +0000 Subject: [python-win32] Removing inheritance In-Reply-To: References: Message-ID: > You can call win32security.SetNamedSecurityInfo with > PROTECTED_DACL_SECURITY_INFORMATION > to prevent inheritance. Thanks Roger. jlc From christophedeze at wanadoo.fr Sat Jan 18 19:10:37 2014 From: christophedeze at wanadoo.fr (=?ISO-8859-1?Q?Christophe_Dez=E9?=) Date: Sat, 18 Jan 2014 19:10:37 +0100 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: References: Message-ID: <52DAC39D.4000704@wanadoo.fr> You can try boa constructor. It's simple.I've begun with it. PS it's a bit obsolete,but i works as well Le 31/12/2013 11:10, Sean Murphy a ?crit : > Hi all. > > I am very very new to Python. I have read the book on programming for Windows with Python that was released in 2000. The book is very good but doesn't give me the basic information I am seeking. Since I am a beginner programmer. > > I want to create a GUI windows app with Python. The program has to use default Windows 32 or 64 bit objects. I wish to get the following components: > > Menu bar > Listview > Treeview > Richedit or a multiline edit field > A couple of buttons. > All objects must be able to be access by the keyboard. either via tab stops (using the tab or shift tab key) and short cut keys. > > > I have a 70 mb text file that is marked up using YML. I wish to show each section in the edit field. The list view shows the name of each item. The tree view will contain categories. > > I have seen PYGUI which I am not sure if it is easier then using the MSF approach which the book above mentions. > > So I really need assistance to progress this home bobbie project to expand my programming skills. Any wikis, documentations, good code examples with explanations, etc I would love to get my hands on. > > I am reading about 3 or 4 books on Python to get up to speed. But only found one book on Win32 programming. I do not want to have to turn around and learn win32 or MFC. If I have to then please point me towards a good book or resource. > > > Regards > Sean > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From rays at blue-cove.com Sat Jan 18 20:19:18 2014 From: rays at blue-cove.com (RayS) Date: Sat, 18 Jan 2014 11:19:18 -0800 Subject: [python-win32] Win32 GUI for beginners. In-Reply-To: <52DAC39D.4000704@wanadoo.fr> References: <52DAC39D.4000704@wanadoo.fr> Message-ID: <201401181919.s0IJJJR2003608@blue-cove.com> At 10:10 AM 1/18/2014, Christophe Dez? wrote: >You can try boa constructor. >It's simple.I've begun with it. > >PS it's a bit obsolete,but i works as well The one thing Boa hasn't been updated for is the AGI widgets, which would be nice. From russell.wallace at gmail.com Mon Jan 20 14:12:04 2014 From: russell.wallace at gmail.com (Russell Wallace) Date: Mon, 20 Jan 2014 13:12:04 +0000 Subject: [python-win32] Compiling Python as a static .exe Message-ID: Hi, I'm trying to compile Python 2.7.6 as a statically linked 64-bit Windows executable, and I'm getting a weird error message. As per http://stackoverflow.com/questions/21231439/unresolved-external-symbol-main-no-underscore I have a command line that looks like: cl /DPy_BUILD_CORE ... /link Advapi32.lib Shell32.lib User32.lib which gets as far as invoking the linker, and then fails with the error: LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup unusually, there is no _ in front of main here, though I tried separately providing both main() and wmain() and it made no difference. What am I doing wrong? -------------- next part -------------- An HTML attachment was scrubbed... URL: From paarnoutse at gmail.com Mon Jan 20 21:46:18 2014 From: paarnoutse at gmail.com (Pieter Aarnoutse) Date: Mon, 20 Jan 2014 21:46:18 +0100 Subject: [python-win32] CastTo interface from other library Message-ID: In the win32com.client class CastTo method, it is assumed that the target interface type exists in the same library as the object to be casted. To work around that issue, I modified the method with an optional argument stating the target interface's library, as follows: def CastTo_mod(ob, target, typelib = None): """'Cast' a COM object to another interface""" mod = None if not typelib is None: # caller provided typelib of target mod = gencache.MakeModuleForTypelib(typelib.clsid, typelib.lcid, int(typelib.major), int(typelib.minor)) if not hasattr(mod, target): raise ValueError("The interface name '%s' does not appear in the " \ "assigned library %r" % (target, typelib.ver_desc)) # todo - should support target being an IID elif hasattr(target, "index"): # string like # for now, we assume makepy for this to work. # ... .... mod = gencache.GetModuleForCLSID(target_clsid) if not mod is None: target_class = getattr(mod, target) # resolve coclass to interface target_class = getattr(target_class, "default_interface", target_class) return target_class(ob) # auto QI magic happens raise ValueError after which I can cast to the type from some other library (targetlib) like object = CastTo(object, 'targetinterfacename', targetlib) where targetlib is a TypelibSpec taken from a search by name in the list returned from selecttlb.EnumTlbs(). Any chance we can have some functionality like that in the release? Thanks, Pieter From skippy.hammond at gmail.com Tue Jan 21 00:42:34 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 21 Jan 2014 10:42:34 +1100 Subject: [python-win32] Access coclass interface? In-Reply-To: <20140113130359.GA3550@gmail.com> References: <20140110142655.GA3439@gmail.com> <20140113130359.GA3550@gmail.com> Message-ID: <52DDB46A.3030405@gmail.com> The problem is that the DLL isn't registered (or not registered in a way it can be used in your current config). First, check the bitted-ness of the library matches Python - eg, if you have a 64bit version of Python, the DLL will also need to be 64 bits (and ditto for 32 bits). If that checks out OK, it may simply not be registered, so "regsvr32 path/to/filename.dll" might get you working. HTH, Mark On 14/01/2014 12:04 AM, Khoroshyy Petro wrote: > Thank you to your respond. > I looked into the library I need using OLE explorer. At the and of my > message I paste the intormation I got from there. Could anybody give me > a tip how to access IJYMonoReqd interface. > Thank you in advance > Petro > -------------- > // Generated .IDL file (by the OLE/COM Object Viewer) > // > // typelib filename: JYMono.dll > > [ > uuid(D7E942DC-3716-4BC1-8DA2-08D273BDC501), > version(1.0), > helpstring("JYMono 1.0 Type Library"), > custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 83951780), > custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1181570652) > ] > library JYMONOLib > { > // TLib : // TLib : JYSystemLib 1.0 Type Library : > // {638F5A15-35A6-4F7D-B8ED-B48A4CD4C619} > importlib("JYSystemLib.dll"); > // Forward declare all types defined in this > // typelib > [ > uuid(BFF968D4-7B20-4D16-BD3A-BDEFEB0863A4), > helpstring("Monochromator Class") > ] > coclass Monochromator { > [default] interface IJYMonoReqd; > [default, source] dispinterface _IJYDeviceReqdEvents; > }; > }; > ------------------------------------------------------- > [ > uuid(BFF968D4-7B20-4D16-BD3A-BDEFEB0863A4), > helpstring("Monochromator Class") > ] > coclass Monochromator { > [default] interface IJYMonoReqd; > [default, source] dispinterface _IJYDeviceReqdEvents; > }; > > ------------------------------------------------------------------ > [ > uuid(7963F672-D074-4F67-B15C-AF022065927E), > helpstring("IJYMonoReqd Interface"), > dual > ] > dispinterface IJYMonoReqd { > properties: > methods: > [id(0x00000001), helpstring("Method Load")] > void Load(); > [id(0x00000002), helpstring("Method Save")] > void Save(); > [id(0x00000003), helpstring("Method OpenCommunicationsEx")] > void OpenCommunicationsEx( > [in] jyCommType __MIDL_0016, > [in] int portNum, > [in, optional] > ....... > ________________________________________________________________________ > On Fri, Jan 10, 2014 at 07:51:57PM +0100, Thomas Heller wrote: >> Am 10.01.2014 15:26, schrieb Khoroshyy Petro: >>> Hi list, >>> I try to control a setup which consist of a monochromator and a CCD camera. >> [...] >>> >>> Now if I try to access a monochromator coclass from another libray in >>> the same way I get com_error: (-2147221005. >>> instrument = win32com.client.Dispatch("JYMONOLib.IJYMonoReqd") >>> or >>> instrument = win32com.client.Dispatch("JYMONOLib.Monochromator") >> >> >> You can use ctypes.WinError to look up the error code if it known >> to windows: >> >>>>> from ctypes import * >>>>> raise WinError(-2147221005) >> Traceback (most recent call last): >> File "", line 1, in >> WindowsError: [Error -2147221005] Ung?ltige Klassenzeichenfolge >>>>> >> >> In english this would read: 'Invalid class string'. >> >> This means that the COM runtime does not know about the >> "JYMONOLib.IJYMonoReqd" and "JYMONOLib.Monochromator" names. >> >> Thomas >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From skippy.hammond at gmail.com Tue Jan 21 00:43:51 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 21 Jan 2014 10:43:51 +1100 Subject: [python-win32] CastTo interface from other library In-Reply-To: References: Message-ID: <52DDB4B7.4040908@gmail.com> On 21/01/2014 7:46 AM, Pieter Aarnoutse wrote: > Any chance we can have some functionality like that in the release? Please submit a patch to sourceforge, and we'll see what we can do. Please be sure to make it is a patch rather than the full version of the modified function. Cheers, Mark From skippy.hammond at gmail.com Tue Jan 21 00:47:00 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 21 Jan 2014 10:47:00 +1100 Subject: [python-win32] Compiling Python as a static .exe In-Reply-To: References: Message-ID: <52DDB574.3000906@gmail.com> [oops - resending with CC to python-win32 list] On 21/01/2014 12:12 AM, Russell Wallace wrote: > Hi, > > I'm trying to compile Python 2.7.6 as a statically linked 64-bit Windows > executable, and I'm getting a weird error message. As per > http://stackoverflow.com/questions/21231439/unresolved-external-symbol-main-no-underscore I > have a command line that looks like: > > cl /DPy_BUILD_CORE ... /link Advapi32.lib Shell32.lib User32.lib What exactly is in the "..." - it looks to me that you simply don't have a main defined (and neither does the code that builds pythonxx.dll - only python.exe has a main) Mark From mail at timgolden.me.uk Tue Jan 21 11:23:35 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 21 Jan 2014 10:23:35 +0000 Subject: [python-win32] Building pywin32 & adsi support Message-ID: <52DE4AA7.4090808@timgolden.me.uk> I'm trying to bring my active_directory module up to scratch with Python 3. I'm hitting a couple of effective showstoppers. First: I can't even build pywin32 for any revision past 337015e6d473, which is when the IConverterSession stuff went in. I've tried a couple of tweaks, but basically: """ com/win32comext/mapi/src/mapi.cpp(645) : fatal error C1083: Cannot open include file: 'IConverterSession.h': No such file or directory error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2 """ I've got a full VS 2010 Professional install, but for the life of me I can't track down that file. It appears to be part of an Outlook API but there doesn't seem to be anything I should be downloading additionally from MSDN. Please feel free to point me in an "I should have seen that" direction! Second: the adsi module won't import even in a released pywin32 218 install on any version of Python 3.x I have installed. It seems to have fallen foul of Python 3's more restricted relative import semantics. This is Python 3.3 but the same happens for 3.2 & 3.1 and for several different incantations of the import (from win32com etc.) >>> import win32com.adsi Traceback (most recent call last): File "", line 1, in File "C:\Python33\lib\site-packages\win32comext\adsi\__init__.py", line 25, in from adsi import * ImportError: No module named 'adsi' >>> A simple fix from 2.7 onwards is to use package-relative imports: "from .adsi import *" but this won't fly with earlier versions. I haven't tried 2.6 but 2.4 certainly won't buy it. I'm aware that the win32com extensions do some fancy footwork with imports for some reason which may or not be necessary any longer, but I don't believe that that's the culprit in this case. Not quite sure where to go with these. I'll experiment a bit to see if I can produce an adsi module/package/import structure which is acceptable to all supported versions, but if anyone's got any bright ideas I'd be happy to hear them! TJG From russell.wallace at gmail.com Tue Jan 21 13:07:01 2014 From: russell.wallace at gmail.com (Russell Wallace) Date: Tue, 21 Jan 2014 12:07:01 +0000 Subject: [python-win32] Compiling Python as a static .exe In-Reply-To: <52DDB574.3000906@gmail.com> References: <52DDB574.3000906@gmail.com> Message-ID: The '...' is the long list of source files I got from pythoncore.vcproj, plus getbuildinfo.c, and the required include directives. You would think a missing main function would be the explanation, but the absence of a leading _ in the error message is a key indicator. To make sure, I tried adding a main function by hand, and also wmain just in case, and the error still occurs. On Mon, Jan 20, 2014 at 11:47 PM, Mark Hammond wrote: > [oops - resending with CC to python-win32 list] > > > On 21/01/2014 12:12 AM, Russell Wallace wrote: > >> Hi, >> >> I'm trying to compile Python 2.7.6 as a statically linked 64-bit Windows >> executable, and I'm getting a weird error message. As per >> http://stackoverflow.com/questions/21231439/unresolved- >> external-symbol-main-no-underscore I >> have a command line that looks like: >> >> cl /DPy_BUILD_CORE ... /link Advapi32.lib Shell32.lib User32.lib >> > > What exactly is in the "..." - it looks to me that you simply don't have a > main defined (and neither does the code that builds pythonxx.dll - only > python.exe has a main) > > Mark > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Tue Jan 21 13:20:02 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 21 Jan 2014 23:20:02 +1100 Subject: [python-win32] Building pywin32 & adsi support In-Reply-To: <52DE4AA7.4090808@timgolden.me.uk> References: <52DE4AA7.4090808@timgolden.me.uk> Message-ID: <52DE65F2.4080805@gmail.com> On 21/01/2014 9:23 PM, Tim Golden wrote: > I'm trying to bring my active_directory module up to scratch with Python > 3. I'm hitting a couple of effective showstoppers. > > First: I can't even build pywin32 for any revision past 337015e6d473, > which is when the IConverterSession stuff went in. I've tried a couple > of tweaks, but basically: > > """ > com/win32comext/mapi/src/mapi.cpp(645) : fatal error C1083: Cannot open > include file: 'IConverterSession.h': No such file or directory > error: command '"c:\Program Files (x86)\Microsoft Visual Studio > 9.0\VC\BIN\cl.exe"' failed with exit status 2 > """ Hrmph - I thought I recall screwing that up and Roger checking a fix in - probably the most recent pywin32 checkin. > Second: the adsi module won't import even in a released pywin32 218 > install on any version of Python 3.x I have installed. It seems to have > fallen foul of Python 3's more restricted relative import semantics. > This is Python 3.3 but the same happens for 3.2 & 3.1 and for several > different incantations of the import (from win32com etc.) > >>>> import win32com.adsi > Traceback (most recent call last): > File "", line 1, in > File "C:\Python33\lib\site-packages\win32comext\adsi\__init__.py", > line 25, in > from adsi import * > ImportError: No module named 'adsi' >>>> And hrmph2! I thought 2to3 did magic there. I'll check tomorrow when I get back to my dev box... Mark From mail at timgolden.me.uk Tue Jan 21 14:13:07 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 21 Jan 2014 13:13:07 +0000 Subject: [python-win32] Building pywin32 & adsi support In-Reply-To: <52DE65F2.4080805@gmail.com> References: <52DE4AA7.4090808@timgolden.me.uk> <52DE65F2.4080805@gmail.com> Message-ID: <52DE7263.1010409@timgolden.me.uk> On 21/01/2014 12:20, Mark Hammond wrote: > On 21/01/2014 9:23 PM, Tim Golden wrote: >> I'm trying to bring my active_directory module up to scratch with Python >> 3. I'm hitting a couple of effective showstoppers. >> >> First: I can't even build pywin32 for any revision past 337015e6d473, >> which is when the IConverterSession stuff went in. I've tried a couple >> of tweaks, but basically: >> >> """ >> com/win32comext/mapi/src/mapi.cpp(645) : fatal error C1083: Cannot open >> include file: 'IConverterSession.h': No such file or directory >> error: command '"c:\Program Files (x86)\Microsoft Visual Studio >> 9.0\VC\BIN\cl.exe"' failed with exit status 2 >> """ > > Hrmph - I thought I recall screwing that up and Roger checking a fix in > - probably the most recent pywin32 checkin. Not unless he's done it in the last 30 minutes ;) > > >> Second: the adsi module won't import even in a released pywin32 218 >> install on any version of Python 3.x I have installed. It seems to have >> fallen foul of Python 3's more restricted relative import semantics. >> This is Python 3.3 but the same happens for 3.2 & 3.1 and for several >> different incantations of the import (from win32com etc.) >> >>>>> import win32com.adsi >> Traceback (most recent call last): >> File "", line 1, in >> File "C:\Python33\lib\site-packages\win32comext\adsi\__init__.py", >> line 25, in >> from adsi import * >> ImportError: No module named 'adsi' >>>>> > > And hrmph2! I thought 2to3 did magic there. Tricky, I'd have thought: that could be a perfectly valid import unchanged for some configurations. I'm not sure how 2to3's static analysis could be sure about it. Thanks for looking into it TJG From jcasale at activenetwerx.com Tue Jan 21 16:36:31 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Tue, 21 Jan 2014 15:36:31 +0000 Subject: [python-win32] Issue with taking ownership Message-ID: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> I have a scenario where I have a directory owned by localhost\Administrators with that group and SYSTEM set to full control without inheritance propagated. Under this, I have a folder owned by another account with only that account granted full control. If I elevate my token and run: win32security.SetNamedSecurityInfo( path, win32security.SE_FILE_OBJECT, win32security.OWNER_SECURITY_INFORMATION, owner.sid, None, None, None ) from the account that has full control (and originally owned it), I can view the new owner. This however doesn't allow the context that changed the owner to then access the dacl and add an ace? That context still cannot view the directory permissions which doesn't jive with the behavior of takeown.exe for example, after assuming ownership with that binary, the alternate context can view the permissions and see the original owner is the only entry in the ACL with full control (as it was)? What has takeown.exe done differently that the above Python code hasn't? The approach and context has been consistent, so it seems I have missed a step with Python that left the directory inconsistent as compared to the state left by takeown.exe. Thanks, jlc From mail at timgolden.me.uk Tue Jan 21 17:45:58 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 21 Jan 2014 16:45:58 +0000 Subject: [python-win32] Issue with taking ownership In-Reply-To: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> References: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> Message-ID: <52DEA446.40408@timgolden.me.uk> On 21/01/2014 15:36, Joseph L. Casale wrote: > I have a scenario where I have a directory owned by localhost\Administrators with > that group and SYSTEM set to full control without inheritance propagated. > > Under this, I have a folder owned by another account with only that account granted > full control. > > If I elevate my token and run: > > win32security.SetNamedSecurityInfo( > path, > win32security.SE_FILE_OBJECT, > win32security.OWNER_SECURITY_INFORMATION, > owner.sid, > None, > None, > None > ) > > from the account that has full control (and originally owned it), I can view the new owner. > > This however doesn't allow the context that changed the owner to then access the dacl > and add an ace? That context still cannot view the directory permissions which doesn't jive > with the behavior of takeown.exe for example, after assuming ownership with that binary, > the alternate context can view the permissions and see the original owner is the only entry > in the ACL with full control (as it was)? I think I understand your setup, which I've simulated below: an "ownership" directory owned by Admins and with SYSTEM & Admins only having full control. No inheritance; no propagation. Then an "other-account" directory below it; again, no inheritance and owned by a different account which has full control. C:\temp>cacls ownership C:\temp\ownership NT AUTHORITY\SYSTEM:(OI)(CI)F BUILTIN\Administrators:(OI)(CI)(NP)F C:\temp>cacls ownership\* C:\temp\ownership\other-account VOUK\goldent:(OI)(CI)F Although you don't show the code you're using to affect the newly-reowned DACL, I suspect the problem is that you're not specifying DACL-only access? In other words, your Ownership status gives you *just enough* permission to write to the DACL to give yourself more. (ie WRITE_DAC). Any attempt to access any other aspect of the security structure will almost certainly fail with access denied. Does that help? TJG From russell.wallace at gmail.com Tue Jan 21 18:08:55 2014 From: russell.wallace at gmail.com (Russell Wallace) Date: Tue, 21 Jan 2014 17:08:55 +0000 Subject: [python-win32] Compiling Python as a static .exe In-Reply-To: References: <52DDB574.3000906@gmail.com> Message-ID: Ah, that works now, thanks! That gets me an executable, which if run from within the Python-2.7.6 directory so it can find Lib/*.py, gives the following error message: Traceback (most recent call last): File ".\lib\site.py", line 548, in main() File ".\lib\site.py", line 537, in main aliasmbcs() File ".\lib\site.py", line 467, in aliasmbcs if enc.startswith('cp'): # "cp***" ? AttributeError: 'NoneType' object has no attribute 'startswith' The relevant section of site.py is: if sys.platform == 'win32': import locale, codecs enc = locale.getdefaultlocale()[1] if enc.startswith('cp'): # "cp***" ? try: codecs.lookup(enc) except LookupError: import encodings encodings._cache[enc] = encodings._unknown encodings.aliases.aliases[enc] = 'mbcs' so it looks like getdefaultlocale is returning blanks. A Google search suggests it sometimes does this for various reasons; I'm not sure how to reconcile that with site.py expecting such to never happen, or why it works in the default DLL build. Any ideas? On Tue, Jan 21, 2014 at 4:32 PM, Jeremy Kloth wrote: > On Tue, Jan 21, 2014 at 5:07 AM, Russell Wallace > wrote: > > The '...' is the long list of source files I got from pythoncore.vcproj, > > plus getbuildinfo.c, and the required include directives. You would > think a > > missing main function would be the explanation, but the absence of a > leading > > _ in the error message is a key indicator. To make sure, I tried adding a > > main function by hand, and also wmain just in case, and the error still > > occurs. > > The list of files also needs "..\Modules\python.c" to create an > executable. (tested with VS2008 for x64). > > That lack of leading underscore comes from how symbols are exported in > 64-bit PEs vs. 32-bit PEs. That is, 64-bit PEs do not prepend an > underscore to exported symbols. > > -- > Jeremy Kloth > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcasale at activenetwerx.com Tue Jan 21 19:14:02 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Tue, 21 Jan 2014 18:14:02 +0000 Subject: [python-win32] Issue with taking ownership In-Reply-To: <52DEA446.40408@timgolden.me.uk> References: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> <52DEA446.40408@timgolden.me.uk> Message-ID: <25266563316544058ef79750a50af2b6@exch.activenetwerx.com> > I think I understand your setup, which I've simulated below: an > "ownership" directory owned by Admins and with SYSTEM & Admins only > having full control. No inheritance; no propagation. Then an > "other-account" directory below it; again, no inheritance and owned by a > different account which has full control. Hi Tim, Exactly. > Although you don't show the code you're using to affect the > newly-reowned DACL, I suspect the problem is that you're not specifying > DACL-only access? In other words, your Ownership status gives you *just > enough* permission to write to the DACL to give yourself more. (ie > WRITE_DAC). Any attempt to access any other aspect of the security > structure will almost certainly fail with access denied. > > Does that help? Sure does, what's odd is the following: The original setup as per the GUI: "\\?\D:\A\sec_test",1,"O:S-1-5-21-1953591057-2569509234-2807485092-500 G:S-1-5-21-1078323535-3347378638-3728908043-513 D:PAI(A;OICI;FA;;;S-1-5-21-1078323535-3347378638-3728908043-1005)" After Python takes ownership: "\\?\D:\A\sec_test",1,"O:S-1-5-21-107832356020011426935-3347378638-3728908043-1005 G:S-1-5-21-1078323535-3347378638-3728908043-513 D:PAI(A;OICI;FA;;;S-1-5-21-1078323535-3347378638-3728908043-1005)" This is just as I would expect, only the owner has changed. Using takeown.exe: "\\?\D:\A\sec_test",1,"O:LAG:S-1-5-21-1078323535-3347378638-3728908043-513 D:PAI(A;OICI;FA;;;S-1-5-21-1078323535-3347378638-3728908043-1005)" It wiped the primary group? Also, the sid of the user returned by takeown (also displayed in GUI) ends in 1005? 513 in a domain context has a different meaning I'll adjust the access to the dacl and try to adjust the permissions as I was. Thanks a ton for all the help. jlc From mail at timgolden.me.uk Tue Jan 21 20:45:26 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 21 Jan 2014 19:45:26 +0000 Subject: [python-win32] Issue with taking ownership In-Reply-To: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> References: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> Message-ID: <52DECE56.2000502@timgolden.me.uk> On 21/01/2014 15:36, Joseph L. Casale wrote: > I have a scenario where I have a directory owned by localhost\Administrators with > that group and SYSTEM set to full control without inheritance propagated. > > Under this, I have a folder owned by another account with only that account granted > full control. > > If I elevate my token and run: > > win32security.SetNamedSecurityInfo( > path, > win32security.SE_FILE_OBJECT, > win32security.OWNER_SECURITY_INFORMATION, > owner.sid, > None, > None, > None > ) > > from the account that has full control (and originally owned it), I can view the new owner. Just by way of a slightly cheeky plug, this is how you'd take ownership using Winsys [1] (from an elevated prompt for simplicity's sake): from winsys import fs fs.dir("c:/temp/ownership").take_ownership() The .dump() thing is just a convenience method to show what the security looks like. Even under the covers, that's just a shorthand for: from winsys import fs, security d = fs.dir("c:/temp/ownership") with d.security(options=None) as s: s.owner = security.me() Having acquired ownership, to take full control: from winsys import fs, security fs.dir("c:/temp/ownership").take_control() # # shorthand for # #with dir("c:/temp/ownership").security(options="d") as s: # s.dacl.append(("tim", "F", "allow")) Note that all this could be knocked sideways by the newer OWNER_SID-based ACEs which can deny even the Owner the possibility of affecting DACLs. TJG [1] https://github.com/tjguk/winsys (Why, yes, it hasn't been updated for well over a year, but I'm always happy to have the excuse...) From jcasale at activenetwerx.com Tue Jan 21 23:07:20 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Tue, 21 Jan 2014 22:07:20 +0000 Subject: [python-win32] Issue with taking ownership In-Reply-To: <52DECE56.2000502@timgolden.me.uk> References: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> <52DECE56.2000502@timgolden.me.uk> Message-ID: <344c7dd7e47b4f37b3a0bfa4a39d6993@exch.activenetwerx.com> > Just by way of a slightly cheeky plug, this is how you'd take ownership > using Winsys [1] (from an elevated prompt for simplicity's sake): Hardly cheeky, That module is far more complete than I'd ever hope to accomplish, right now I am stuck between Python 3 usage and an immediate need to get a current implementation functional. In my scenario (while the token is elevated) how does one replace a DACL with a new one that I add an ACE granting my context full control without reading the security descriptor, or, with elevated state active, how can I also add read_control when I get write_dac so I can read the sd, and append an ACE versus blowing out the dacl? Thanks! jlc From jcasale at activenetwerx.com Wed Jan 22 03:37:35 2014 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Wed, 22 Jan 2014 02:37:35 +0000 Subject: [python-win32] Issue with taking ownership In-Reply-To: <344c7dd7e47b4f37b3a0bfa4a39d6993@exch.activenetwerx.com> References: <62d7f4dc886a45ea96e54d9732191cab@exch.activenetwerx.com> <52DECE56.2000502@timgolden.me.uk> <344c7dd7e47b4f37b3a0bfa4a39d6993@exch.activenetwerx.com> Message-ID: <3b0d049d7c594f4c907d55316fd081e7@exch.activenetwerx.com> > In my scenario (while the token is elevated) how does one replace a DACL with > a new one that I add an ACE granting my context full control without reading the > security descriptor, or, with elevated state active, how can I also add read_control > when I get write_dac so I can read the sd, and append an ACE versus blowing > out the dacl? Turns out that the code to logon and impersonate was using LOGON32_LOGON_NEW_CREDENTIALS instead of LOGON32_LOGON_INTERACTIVE. According to GetNamedSecurityInfo docs at msdn [1], "To read the owner, group, or DACL from the object's security descriptor, the object's DACL must grant READ_CONTROL access to the caller, or the caller must be the owner of the object." So although I passed ownership to the account logged in and impersonated, the context for which the system saw the attempt to read the security descriptor came from the account running the code. Thanks Tim, jlc [1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa446645(v=vs.85).aspx From skippy.hammond at gmail.com Sat Jan 25 04:43:40 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 25 Jan 2014 14:43:40 +1100 Subject: [python-win32] Building pywin32 & adsi support In-Reply-To: <52DE4AA7.4090808@timgolden.me.uk> References: <52DE4AA7.4090808@timgolden.me.uk> Message-ID: <52E332EC.2080005@gmail.com> On 21/01/2014 9:23 PM, Tim Golden wrote: > I'm trying to bring my active_directory module up to scratch with Python > 3. I'm hitting a couple of effective showstoppers. > > First: I can't even build pywin32 for any revision past 337015e6d473, > which is when the IConverterSession stuff went in. I've tried a couple > of tweaks, but basically: > > """ > com/win32comext/mapi/src/mapi.cpp(645) : fatal error C1083: Cannot open > include file: 'IConverterSession.h': No such file or directory > error: command '"c:\Program Files (x86)\Microsoft Visual Studio > 9.0\VC\BIN\cl.exe"' failed with exit status 2 > """ hrmph - that file was sitting in my source tree, but apparently was being ignored by hg due to an overly greedy .hgignore line. I just added it - sorry about that. > Second: the adsi module won't import even in a released pywin32 218 > install on any version of Python 3.x I have installed. It seems to have > fallen foul of Python 3's more restricted relative import semantics. > This is Python 3.3 but the same happens for 3.2 & 3.1 and for several > different incantations of the import (from win32com etc.) > >>>> import win32com.adsi > Traceback (most recent call last): > File "", line 1, in > File "C:\Python33\lib\site-packages\win32comext\adsi\__init__.py", > line 25, in > from adsi import * > ImportError: No module named 'adsi' >>>> > > > A simple fix from 2.7 onwards is to use package-relative imports: > > "from .adsi import *" hrmph - that's exactly what my version of __init__.py has, and as I mentioned, I believe it's done by 2to3 (by way of one of the "import imports" fixers we tell 2to3 to use). The build process sucks in that if you interrupt a build, you might end up with the "2.x" version of the file installed, as it doesn't know to re-run 2to3 at build time. Maybe try nuking your "dist" directory and rebuild from scratch? Hope this helps... Mark From mail at timgolden.me.uk Sun Jan 26 21:02:57 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Sun, 26 Jan 2014 20:02:57 +0000 Subject: [python-win32] Building pywin32 & adsi support In-Reply-To: <52E332EC.2080005@gmail.com> References: <52DE4AA7.4090808@timgolden.me.uk> <52E332EC.2080005@gmail.com> Message-ID: <52E569F1.9040104@timgolden.me.uk> On 25/01/2014 03:43, Mark Hammond wrote: [...] > hrmph - that file was sitting in my source tree, but apparently was > being ignored by hg due to an overly greedy .hgignore line. I just > added it - sorry about that. [...] > hrmph - that's exactly what my version of __init__.py has, and as I > mentioned, I believe it's done by 2to3 (by way of one of the "import > imports" fixers we tell 2to3 to use). The build process sucks in that > if you interrupt a build, you might end up with the "2.x" version of the > file installed, as it doesn't know to re-run 2to3 at build time. Maybe > try nuking your "dist" directory and rebuild from scratch? Pulled in your changes; fresh clone to eliminate any build artefacts and... bingo! It certainly builds and imports now, so thanks. I'll have to wait until I get into work tomorrow to try out the adsi stuff in an AD environment. Thanks again TJG From robin at reportlab.com Wed Jan 29 13:56:12 2014 From: robin at reportlab.com (Robin Becker) Date: Wed, 29 Jan 2014 12:56:12 +0000 Subject: [python-win32] running a service within a virtual environment Message-ID: <52E8FA6C.4000500@chamonix.reportlab.co.uk> 0) I'm trying to run a django app as a service using cherrypy I have seen http://www.guguweb.com/2013/10/13/django-on-windows/ and that looks pretty good as a start. 1) The application is currently set up as a virtual environment, but it was created as using enthought python. It has pywin32 installed, but running pythonservice.exe gives an error "cannot import module site" My questions are: should I dump enthought and install python and all the dependenxies normally? Also is it possible/practical to get a service to run inside a python virtual environment? -- Robin Becker From robin at reportlab.com Thu Jan 30 14:18:11 2014 From: robin at reportlab.com (Robin Becker) Date: Thu, 30 Jan 2014 13:18:11 +0000 Subject: [python-win32] running a service within a virtual environment In-Reply-To: <52E8FA6C.4000500@chamonix.reportlab.co.uk> References: <52E8FA6C.4000500@chamonix.reportlab.co.uk> Message-ID: <52EA5113.5010105@chamonix.reportlab.co.uk> On 29/01/2014 12:56, Robin Becker wrote: ........... > 1) The application is currently set up as a virtual environment, but it was > created as using enthought python. It has pywin32 installed, but running > pythonservice.exe gives an error "cannot import module site" > > > My questions are: should I dump enthought and install python and all the > dependenxies normally? > > Also is it possible/practical to get a service to run inside a python virtual > environment? To answer my own question I find that I can run services based on a virtual environment; just haven't been able to do so in a venv created by the enthought distribution of Python. -- Robin Becker From bramesh.vt at gmail.com Thu Jan 30 23:23:58 2014 From: bramesh.vt at gmail.com (Bharath Ramesh) Date: Thu, 30 Jan 2014 14:23:58 -0800 Subject: [python-win32] Building Python-2.7.6 for 64bit Windows Message-ID: I had initially posted this to python-help and I was pointed to post on this mailing list. I am trying to automate building Python-2.7.6 for our project. The reason we are not using a precompiled python is because in our project we embed python into our applications address space. Our application uses a different version of few of the libraries that Python is built with, most importantly OpenSSL. Since they exist in the same address space we have issues with our application crashing very horribly. We decided that we should compile Python and its dependencies so that we can ensure consistency. I come from a Linux background and building on Windows is new to me and I am like a fish out of water. I did some reading and poking around the PCbuild, PC, Tools directory I am trying to automate the process as follows 1) Set the environment variables: specifically PATH, INCLUDE, LIB, LIBPATH to point to the x64 directory of Windows SDK and VC directories for PATH and amd64 directories for LIB and LIBPATH. I basically looked into the path that is being set by vcvarsamd64.bat and adding them to appropriate environment variables. I am not adding the path to FRAMEWORK. 2) Then start the build process using 'vcbuild /useenv /nocolor pcbuild.sln "Release|x64"'. However, when I the vcbuild command is issued it still tries to build make_versioninfo and make_buildinfo as "Release|Win32". This causes their builds to break with the following error "fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'". I was wondering how do I ensure that these are built appropriately as either x64 or how should I set the path appropriately so that vcbuild picks the correct path for Win32 for these two projects and x64 paths for the remaining projects. As a work around I manually edited the pcbuild.sln file and set it to build for "Release|x64" for make_versioninfo and make_buildinfo. That threw few more errors about unresolved symbols which I got around to by manually editing the respective vcproj files. I do have numerous other build issues that I need to fix. I was hoping somebody could help me with getting python building correctly. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Fri Jan 31 01:10:57 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 30 Jan 2014 16:10:57 -0800 Subject: [python-win32] Building Python-2.7.6 for 64bit Windows In-Reply-To: References: Message-ID: <52EAEA11.7020608@probo.com> Bharath Ramesh wrote: > > I am trying to automate building Python-2.7.6 for our project. The > reason we are not using a precompiled python is because in our project > we embed python into our applications address space. Our application > uses a different version of few of the libraries that Python is built > with, most importantly OpenSSL. Since they exist in the same address > space we have issues with our application crashing very horribly. We > decided that we should compile Python and its dependencies so that we > can ensure consistency. Well, hang on a minute. There are a few issues here, and overall I think you're on the wrong track completely. The address space thing is a red herring. The Python interpreter is actually a DLL, and it ALWAYS runs in the address space of the process that invokes it. If you look at the command line "python.exe", you'll see that it is tiny (27k bytes). All it does is load the Python DLL and jump to it. More importantly, neither the base Python interpreter nor any part of its standard library uses OpenSSL, so rebuilding the interpreter isn't going to help you one bit. If you are having conflicts, then it is a conflict with some add-on module. Now, maybe you need to rebuild that add-in module using your OpenSSL, but you can do that without rebuilding the interpreter. You need to take some time and chase down what the crash really is, because I don't think you really know right now. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From bramesh.vt at gmail.com Fri Jan 31 02:43:10 2014 From: bramesh.vt at gmail.com (Bharath Ramesh) Date: Thu, 30 Jan 2014 17:43:10 -0800 Subject: [python-win32] Building Python-2.7.6 for 64bit Windows In-Reply-To: References: Message-ID: >Bharath Ramesh wrote: >> >> I am trying to automate building Python-2.7.6 for our project. The >> reason we are not using a precompiled python is because in our project >> we embed python into our applications address space. Our application >> uses a different version of few of the libraries that Python is built >> with, most importantly OpenSSL. Since they exist in the same address >> space we have issues with our application crashing very horribly. We >> decided that we should compile Python and its dependencies so that we >> can ensure consistency. > >Well, hang on a minute. There are a few issues here, and overall I >think you're on the wrong track completely. > >The address space thing is a red herring. The Python interpreter is >actually a DLL, and it ALWAYS runs in the address space of the process >that invokes it. If you look at the command line "python.exe", you'll >see that it is tiny (27k bytes). All it does is load the Python DLL and >jump to it. > >More importantly, neither the base Python interpreter nor any part of >its standard library uses OpenSSL, so rebuilding the interpreter isn't >going to help you one bit. If you are having conflicts, then it is a >conflict with some add-on module. Now, maybe you need to rebuild that >add-in module using your OpenSSL, but you can do that without rebuilding >the interpreter. > We use numerous third party libraries, one being PyOpenSSL We have already rebuilt it with a newer version of OpenSSL. We continue to have the same issue. We have some part of the code that make secure connection using sockets, I think those end up using the ssl module from Python. However, I am not the one who debugged this to be this issue on windows >You need to take some time and chase down what the crash really is, >because I don't think you really know right now. Another team member who had debugged the windows side of our project. Unfortunately, I am no windows expert and he was the one who done the initial debugging and come to the conclusion that the issue is with regards to multiple OpenSSL dll being loaded into the same address space. He is not part of our team any more and I am faced with rebuilding all our tools to ensure consistency. I am not subscribed to the list would appreciate if I am copied on the reply. -- Bharath From mark.mordeca at prosensus.ca Fri Jan 31 16:08:00 2014 From: mark.mordeca at prosensus.ca (Mark Mordeca) Date: Fri, 31 Jan 2014 10:08:00 -0500 Subject: [python-win32] Excel Workbooks Exception Message-ID: <70b852da9c8b7d618bc72c1c13813eee@mail.gmail.com> Hello, I sometimes get a random exception when trying to open an Excel file. It is not consistent. I will get the exception, and then try it again and it will work fine. Simple two lines of code: xl=win32com.client.DispatchEx("Excel.Application") book=xl.Workbooks.Open(self.__filename, ReadOnly=True) where self.__filename is a path to an Excel file. The exception I get is: : Excel.Application.Workbooks It's very confusing because 1. I will get the exception, try it again, and it will work fine. 2. How is it even possible to Dispatch successfully but then it not have a core attribute like Workbooks? Any insight is greatly appreciated. Thanks, Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Fri Jan 31 16:48:29 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 31 Jan 2014 15:48:29 +0000 Subject: [python-win32] Excel Workbooks Exception In-Reply-To: <70b852da9c8b7d618bc72c1c13813eee@mail.gmail.com> References: <70b852da9c8b7d618bc72c1c13813eee@mail.gmail.com> Message-ID: <52EBC5CD.4020006@timgolden.me.uk> On 31/01/2014 15:08, Mark Mordeca wrote: > I sometimes get a random exception when trying to open an Excel file. > It is not consistent. I will get the exception, and then try it > again and it will work fine. > xl=win32com.client.DispatchEx("Excel.Application") > > book=xl.Workbooks.Open(self.__filename, ReadOnly=True) > > where self.__filename is a path to an Excel file. > > > > The exception I get is: > > : Excel.Application.Workbooks > > > > It?s very confusing because > > 1. I will get the exception, try it again, and it will work fine. > > 2. How is it even possible to Dispatch successfully but then it not > have a core attribute like Workbooks? You haven't given us a lot to work with, not even the full exception traceback (which sometimes helps). A couple of things which *might* be worth trying (and, at least, won't do any harm): * Ensure that Excel has a static dispatch object generated for it; an easy way to do this is: win32com.client.gencache.EnsureDispatch("Excel.Application"). * Use GetObject to open a named file. (Ultimately, this is calling a dispatch mechanism under the covers but you never know what difference the code path might make): xls = win32com.client.GetObject(r"c:\temp\spreadsheet.xls") I can see no reason why either should make any real difference, but they're worth knowing about at any rate. TJG From mark.mordeca at prosensus.ca Fri Jan 31 17:30:26 2014 From: mark.mordeca at prosensus.ca (Mark Mordeca) Date: Fri, 31 Jan 2014 11:30:26 -0500 Subject: [python-win32] Excel Workbooks Exception In-Reply-To: <52EBC5CD.4020006@timgolden.me.uk> References: <70b852da9c8b7d618bc72c1c13813eee@mail.gmail.com> <52EBC5CD.4020006@timgolden.me.uk> Message-ID: Thanks for your reply. Unfortunately, the traceback isn't helpful.... it's just pointing to lines in my own code that arrive at calling these two lines because I re-raise exceptions (I'm not going to get into the details of this, it is just a fact of this part of code I have to deal with because this particular type of exception is not ever expected). Thanks for your two alternate ways to create the Excel instance, I have a question about them though. I use DispatchEx because I have to create a new instance of Excel and open the Excel file in that instance, in all cases. Does EnsureDispatch or GetObject always create new instances of Excel? If not, is there a flag to either of these that will make them do so? (Sorry, I am having trouble finding documentation on these two methods). Thanks. -----Original Message----- From: python-win32 [mailto:python-win32-bounces+mark.mordeca=prosensus.ca at python.org] On Behalf Of Tim Golden Sent: January-31-14 10:48 AM To: python-win32 at python.org Subject: Re: [python-win32] Excel Workbooks Exception On 31/01/2014 15:08, Mark Mordeca wrote: > I sometimes get a random exception when trying to open an Excel file. > It is not consistent. I will get the exception, and then try it > again and it will work fine. > xl=win32com.client.DispatchEx("Excel.Application") > > book=xl.Workbooks.Open(self.__filename, ReadOnly=True) > > where self.__filename is a path to an Excel file. > > > > The exception I get is: > > : Excel.Application.Workbooks > > > > It's very confusing because > > 1. I will get the exception, try it again, and it will work fine. > > 2. How is it even possible to Dispatch successfully but then it not > have a core attribute like Workbooks? You haven't given us a lot to work with, not even the full exception traceback (which sometimes helps). A couple of things which *might* be worth trying (and, at least, won't do any harm): * Ensure that Excel has a static dispatch object generated for it; an easy way to do this is: win32com.client.gencache.EnsureDispatch("Excel.Application"). * Use GetObject to open a named file. (Ultimately, this is calling a dispatch mechanism under the covers but you never know what difference the code path might make): xls = win32com.client.GetObject(r"c:\temp\spreadsheet.xls") I can see no reason why either should make any real difference, but they're worth knowing about at any rate. TJG _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 From timr at probo.com Fri Jan 31 19:47:25 2014 From: timr at probo.com (Tim Roberts) Date: Fri, 31 Jan 2014 10:47:25 -0800 Subject: [python-win32] Building Python-2.7.6 for 64bit Windows In-Reply-To: References: Message-ID: <52EBEFBD.9060704@probo.com> Bharath Ramesh wrote: > We use numerous third party libraries, one being PyOpenSSL We have > already rebuilt it with a newer version of OpenSSL. We continue to > have the same issue. We have some part of the code that make secure > connection using sockets, I think those end up using the ssl module > from Python. However, I am not the one who debugged this to be this > issue on windows I need to back off of my original assertion, because I was wrong. The Python ssl module does use OpenSSL. I didn't see it doing any imports, so I assumed it was using something else. However, it links to it statically, so there shouldn't be any DLL conflicts. > Another team member who had debugged the windows side of our project. > Unfortunately, I am no windows expert and he was the one who done the > initial debugging and come to the conclusion that the issue is with > regards to multiple OpenSSL dll being loaded into the same address > space. He is not part of our team any more and I am faced with > rebuilding all our tools to ensure consistency. It is not generally possible to load multiple versions of a single DLL in Windows. The system loader will satisfy the externals from the already loaded version. You certainly can have multiple copies of a statically linked library, but it's not clear to me how that would cause any problems. > I am not subscribed to the list would appreciate if I am copied on the reply. Then please be sure to cc the list. And wouldn't it be easier just to join the list until your issue is resolved? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc.