From dave at kjams.com Wed Sep 4 17:53:20 2013 From: dave at kjams.com (David M. Cotter) Date: Wed, 4 Sep 2013 08:53:20 -0700 Subject: [python-win32] embedded python can't import win32api Message-ID: I'm embedding Python27 in my app. I have users install ActivePython27 in order to take advantage of python in my app, so the python installation can't be touched as it's on the end user's machine. When I attempt to do: >import win32api i get this: >Traceback (most recent call last): > File "startup.py", line 5, in >ImportError: DLL load failed: The specified module could not be found. I someone suggested i manually load the dependent libraries in the correct order, like this: >import pywintypes >import pythoncom >import win32api but then i get this: >Traceback (most recent call last): > File "startup.py", line 3, in > File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 124, in > __import_pywin32_system_module__("pywintypes", globals()) > File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 64, in __import_pywin32_system_module__ > import _win32sysloader ImportError: DLL load failed: The specified module could not be found. the ultimate goal here is actually to do this: >from win32com.client.gencache import EnsureDispatch which currently yields: >Traceback (most recent call last): > File "startup.py", line 3, in > File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in > import win32api, sys, os >ImportError: DLL load failed: The specified module could not be found. So, if anyone has any idea, that would be super duper great. thanks so much! notes: my paths are definitely set correctly, as i used the activepython installer when i run my script the first thing i see in the output window is: > 'kJams 2 Debug.exe': Loaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll' > 'kJams 2 Debug.exe': Unloaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > 'kJams 2 Debug.exe': Unloaded 'C:\Windows\SysWOW64\pywintypes27.dll' so i know it is finding those libraries i've searched the intertubes and found many, many people with this problem, over the years, but no real solutions. "reinstall" they say, well, i've done that several times. anyone know why this is? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Sep 4 21:20:28 2013 From: vernondcole at gmail.com (Vernon D. Cole) Date: Wed, 4 Sep 2013 20:20:28 +0100 Subject: [python-win32] embedded python can't import win32api In-Reply-To: References: Message-ID: Dear David: Perhaps someone on this list can give a better answer than the one I am about to give -- because I don't like what I am going to say... ActiveState repackages Python, pywin32, and several other products in order to make it easier to install all of them together, and they call their package Active Python. We here in the pywin32 community don't really know what they may have done with their installer which might be contributing to your problem. Obviously, the .dll files are not where the loader expects them to be (or are incorrectly protected) but where they are, and how to fix the problem, we don't know. At least, I do not. May I suggest that you try ActiveState support at http://community.activestate.com/forum ? They also have commercial support and you could surely find help that way. Again, I apologise for giving such an unhelpful answer. -- Vernon Cole On Wed, Sep 4, 2013 at 4:53 PM, David M. Cotter wrote: > I'm embedding Python27 in my app. I have users install ActivePython27 in > order to take advantage of python in my app, so the python installation > can't be touched as it's on the end user's machine. > > When I attempt to do: > >import win32api > > i get this: > >Traceback (most recent call last): > > File "startup.py", line 5, in > >ImportError: DLL load failed: The specified module could not be found. > > I someone suggested i manually load the dependent libraries in the correct > order, like this: > > >import pywintypes > >import pythoncom > >import win32api > > but then i get this: > >Traceback (most recent call last): > > File "startup.py", line 3, in > > File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 124, > in > > __import_pywin32_system_module__("pywintypes", globals()) > > File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 64, > in __import_pywin32_system_module__ > > import _win32sysloader > ImportError: DLL load failed: The specified module could not be found. > > the ultimate goal here is actually to do this: > >from win32com.client.gencache import EnsureDispatch > > which currently yields: > >Traceback (most recent call last): > > File "startup.py", line 3, in > > File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in > > import win32api, sys, os > >ImportError: DLL load failed: The specified module could not be found. > > So, if anyone has any idea, that would be super duper great. thanks so > much! > > notes: > my paths are definitely set correctly, as i used the activepython installer > when i run my script the first thing i see in the output window is: > > > 'kJams 2 Debug.exe': Loaded > 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > > 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll' > > 'kJams 2 Debug.exe': Unloaded > 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > > 'kJams 2 Debug.exe': Unloaded 'C:\Windows\SysWOW64\pywintypes27.dll' > > so i know it is finding those libraries > > i've searched the intertubes and found many, many people with this > problem, over the years, but no real solutions. "reinstall" they say, well, > i've done that several times. anyone know why this is? > > _______________________________________________ > 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 mhammond at skippinet.com.au Fri Sep 6 00:45:52 2013 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 06 Sep 2013 08:45:52 +1000 Subject: [python-win32] embedded python can't import win32api In-Reply-To: <9AAEA25A-1444-41F8-BF8D-D794FDCE90FE@kjams.com> References: <5228014A.3080703@gmail.com> <9AAEA25A-1444-41F8-BF8D-D794FDCE90FE@kjams.com> Message-ID: <522909A0.4030605@skippinet.com.au> [re-adding python-win32] On 6/09/2013 2:30 AM, David M. Cotter wrote: > there are no instructions i can find anywhere about how to "bundle python with my app" > if i could find out how to do that i would. It is literally as simply as bundling up a Python distribution, pywin32 (and any other modules you depend on) into a directory and installing it. You probably don't need to bother with any installation tasks - eg, nothing will need to be registered etc - it should "just work". Mark > > On Sep 4, 2013, at 8:58 PM, Mark Hammond wrote: > >> I suspect the problem is that the MS C runtime redistributables can't be found - they are probably installed by ActivePython next to the python executable, so aren't picked up by your app. The solution is probably to put them next to your app (or better still, just bundle Python with your app, then your app and python.exe can live in the same directory - which is where those redist files can live. >> >> HTH, >> >> Mark > From timr at probo.com Mon Sep 23 19:31:14 2013 From: timr at probo.com (Tim Roberts) Date: Mon, 23 Sep 2013 10:31:14 -0700 Subject: [python-win32] Windows 7 Python Command Line Use Message-ID: <52407AE2.4070702@probo.com> I'm posting here as a help for others, because if *I* got tripped up by this, then it's certain others are going to fall into the same trap. I've been doing Python for 16 years and Windows for 24. I should know these things. I recently had to replace my main development machine. Part of that involved moving from the venerable but reliable Windows XP to Windows 7 64. I installed the 32-bit Python 2.7.5, because I do still use some packages that don't support Python 3. On the new machine, any attempt to run a Python script from the command line using the .py file associations, and using stdout redirection, failed: C:\tmp>cat happy.py print "Happiness!" C:\tmp>python happy.py Happiness! C:\tmp>python happy.py > ok C:\tmp>happy.py Happiness! C:\tmp>happy.py > notok * close failed in file object destructor:** ** sys.excepthook is missing** ** lost sys.stderr* C:\tmp> I am pretty good with Google, and I found a lot of references to this problem, but none of the suggestions made any sense. Some people said the flaw was installing as administrator, and suggested creating a separate administrator account to install as. That's silly. In the end, the answer came from a Microsoft Knowledge Base article from Windows 2000, of all things. It says the problem is fixed in later versions, but apparently it is not. The article includes a quick registry hack (InheritConsoleHandles), and this DOES fix the problem. You have to restart Explorer after making the change (which you can do from Task Manager, or by rebooting): http://support.microsoft.com/kb/321788 -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mc at mclaveau.com Tue Sep 24 14:02:06 2013 From: mc at mclaveau.com (Michel Claveau) Date: Tue, 24 Sep 2013 14:02:06 +0200 Subject: [python-win32] Windows 7 Python Command Line Use In-Reply-To: <52407AE2.4070702@probo.com> References: <52407AE2.4070702@probo.com> Message-ID: <201892C68BE84B7E8788CC94BA84CC3F@M14> Hi! Thank you for info -- Michel Claveau ----- Original Message ----- From: "Tim Roberts" To: "Python-Win32 List" Sent: Monday, September 23, 2013 7:31 PM Subject: [python-win32] Windows 7 Python Command Line Use > I'm posting here as a help for others, because if *I* got tripped up by > this, then it's certain others are going to fall into the same trap. > I've been doing Python for 16 years and Windows for 24. I should know > these things. > > I recently had to replace my main development machine. Part of that > involved moving from the venerable but reliable Windows XP to Windows 7 > 64. I installed the 32-bit Python 2.7.5, because I do still use some > packages that don't support Python 3. > > On the new machine, any attempt to run a Python script from the command > line using the .py file associations, and using stdout redirection, > failed: > > C:\tmp>cat happy.py > print "Happiness!" > > C:\tmp>python happy.py > Happiness! > > C:\tmp>python happy.py > ok > > C:\tmp>happy.py > Happiness! > > C:\tmp>happy.py > notok > * close failed in file object destructor:** > ** sys.excepthook is missing** > ** lost sys.stderr* > > C:\tmp> > > I am pretty good with Google, and I found a lot of references to this > problem, but none of the suggestions made any sense. Some people said > the flaw was installing as administrator, and suggested creating a > separate administrator account to install as. That's silly. > > In the end, the answer came from a Microsoft Knowledge Base article from > Windows 2000, of all things. It says the problem is fixed in later > versions, but apparently it is not. The article includes a quick > registry hack (InheritConsoleHandles), and this DOES fix the problem. > You have to restart Explorer after making the change (which you can do > from Task Manager, or by rebooting): > > http://support.microsoft.com/kb/321788 > > -- > 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 joss.gray at d3technologies.com Tue Sep 24 15:39:14 2013 From: joss.gray at d3technologies.com (Joss Gray) Date: Tue, 24 Sep 2013 14:39:14 +0100 Subject: [python-win32] Accessing MSFT_ classes using python com / wmi Message-ID: I'm trying to access the MSFT_ classes in python. Specifically MSFT_NetAdapter. Win32_ works fine. But whatever I try, I get 0x80041002 WBEM_E_NOT_FOUND 0x8004100E WBEM_E_INVALID_NAMESPACE errors. Specifically I been basing my code on the http://www.activexperts.com/admin/scripts/wmiscripts/python/0227/ example. But I substituted 'StandardCimv2' with 'cimv2' as that was giving me an invalid namespace error. Are these classes accessible using pywin32? Regards, -- *Joss Gray* -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Sep 24 15:45:39 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 24 Sep 2013 14:45:39 +0100 Subject: [python-win32] Accessing MSFT_ classes using python com / wmi In-Reply-To: References: Message-ID: <52419783.4010906@timgolden.me.uk> On 24/09/2013 14:39, Joss Gray wrote: > I'm trying to access the MSFT_ classes in python. Specifically > MSFT_NetAdapter. Win32_ works fine. > > But whatever I try, I get > > 0x80041002 WBEM_E_NOT_FOUND > 0x8004100E WBEM_E_INVALID_NAMESPACE > > errors. > > Specifically I been basing my code on the > http://www.activexperts.com/admin/scripts/wmiscripts/python/0227/ > example. But I substituted 'StandardCimv2' with 'cimv2' as that was > giving me an invalid namespace error. > > Are these classes accessible using pywin32? [Blatant self-advertising follows...] It's probably worth your installing the wmi module: https://pypi.python.org/pypi/WMI/ (pip install wmi will do it). In addition to easing the pain of using wmi with Python, it includes a useful wmiweb.py script, installed in eg c:\python27\scripts which lets you browse the available namespaces and objects. TJG From mail at timgolden.me.uk Tue Sep 24 15:49:21 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 24 Sep 2013 14:49:21 +0100 Subject: [python-win32] Accessing MSFT_ classes using python com / wmi In-Reply-To: References: Message-ID: <52419861.6090303@timgolden.me.uk> On 24/09/2013 14:39, Joss Gray wrote: > I'm trying to access the MSFT_ classes in python. Specifically > MSFT_NetAdapter. Win32_ works fine. > > But whatever I try, I get > > 0x80041002 WBEM_E_NOT_FOUND > 0x8004100E WBEM_E_INVALID_NAMESPACE > > errors. Incidentally, the MSDN page for that class: http://msdn.microsoft.com/en-us/library/hh968170(v=vs.85).aspx indicates that it's Win8 / Server2012 only. Certainly that namespace doesn't exist on my Win7 box. TJG From joss.gray at d3technologies.com Tue Sep 24 16:04:04 2013 From: joss.gray at d3technologies.com (Joss Gray) Date: Tue, 24 Sep 2013 15:04:04 +0100 Subject: [python-win32] Accessing MSFT_ classes using python com / wmi In-Reply-To: <52419861.6090303@timgolden.me.uk> References: <52419861.6090303@timgolden.me.uk> Message-ID: Ahhh, that would be the reason then. I'm running Windows 7. Thanks. On 24 September 2013 14:49, Tim Golden wrote: > On 24/09/2013 14:39, Joss Gray wrote: > > I'm trying to access the MSFT_ classes in python. Specifically > > MSFT_NetAdapter. Win32_ works fine. > > > > But whatever I try, I get > > > > 0x80041002 WBEM_E_NOT_FOUND > > 0x8004100E WBEM_E_INVALID_NAMESPACE > > > > errors. > > Incidentally, the MSDN page for that class: > > http://msdn.microsoft.com/en-us/library/hh968170(v=vs.85).aspx > > indicates that it's Win8 / Server2012 only. Certainly that namespace > doesn't exist on my Win7 box. > > TJG > > -- *Joss Gray* -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjudge at mail.sdsu.edu Thu Sep 26 05:20:51 2013 From: rjudge at mail.sdsu.edu (Robert Judge) Date: Thu, 26 Sep 2013 03:20:51 +0000 (UTC) Subject: [python-win32] ImportError: DLL load failed References: <1342140310.16733.YahooMailNeo@web164001.mail.gq1.yahoo.com> <4FFF7C3C.6090401@gmail.com> Message-ID: Mark Hammond gmail.com> writes: > > On 13/07/2012 10:45 AM, Jane Chen wrote: > > Hi all, > > > > I would like to add python win32 to Portable Python distribution with > > PyGTK for Windows > > http://fnch.users.sourceforge.net/portablepygtkwindows.html > > I installed the pywin32 in the python\Lib\site-packages folder. PC #1 > > can find win32api.pyd. After that, I copied the whole portable python > > distribution folder to PC#2. I got the following message: > > import win32file, win32api > > ImportError: DLL load failed: The specified module could not be found. > > > > Can anyone please help me with this issue? > > I'm guessing that pywintypes27.dll and pythoncom27.dll aren't anywhere > on the PATH on PC#2 - try copying them next to python.exe. > > HTH, > > Mark > This was the answer for me. I had tried moving the .pyd files next to the .exe, but you had the answer Mark. When I saw your response I had already searched through enough forum to recognize your name and know your were the THE guy. Thanks for your time skill and willingness to share your code and knowledge. From nmanu14387 at gmail.com Sat Sep 28 20:57:30 2013 From: nmanu14387 at gmail.com (manu agarwal) Date: Sun, 29 Sep 2013 00:27:30 +0530 Subject: [python-win32] Your confirmation is required to join the python-win32 mailing list In-Reply-To: References: Message-ID: Hi All, I am new to the Python, i have written one code in python that read the data from the XML file and based on the input from the xml file it gives the output. Later i converted the Python script to .exe file to run on the multiple windows server. The Python file is running fine when i execute script.py from the machine where the python installed, but it gives an error when i ran the script.exe file on the machine. Below is the error : *AttributeError: module object has no attribute sax* * * I am using Python2.7 and python 2.7 py2exe. Please assist me to resolve this error. Thanks Manu Agarwal On Sun, Sep 29, 2013 at 12:09 AM, < python-win32-confirm+2413853733fdbfea88bb57eb8e642ab54c18c44a at python.org>wrote: > Mailing list subscription confirmation notice for mailing list > python-win32 > > We have received a request from 123.237.78.102 for subscription of > your email address, "nmanu14387 at gmail.com", to the > python-win32 at python.org mailing list. To confirm that you want to be > added to this mailing list, simply reply to this message, keeping the > Subject: header intact. Or visit this web page: > > > https://mail.python.org/mailman/confirm/python-win32/2413853733fdbfea88bb57eb8e642ab54c18c44a > > > Or include the following line -- and only the following line -- in a > message to python-win32-request at python.org: > > confirm 2413853733fdbfea88bb57eb8e642ab54c18c44a > > Note that simply sending a `reply' to this message should work from > most mail readers, since that usually leaves the Subject: line in the > right form (additional "Re:" text in the Subject: is okay). > > If you do not wish to be subscribed to this list, please simply > disregard this message. If you think you are being maliciously > subscribed to the list, or have any other questions, send them to > python-win32-owner at python.org. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Sep 30 19:20:50 2013 From: timr at probo.com (Tim Roberts) Date: Mon, 30 Sep 2013 10:20:50 -0700 Subject: [python-win32] Your confirmation is required to join the python-win32 mailing list In-Reply-To: References: Message-ID: <5249B2F2.5050603@probo.com> manu agarwal wrote: > Hi All, You should always create a meaningful subject line when you post to the mailing list. This one is not meaningful. > I am new to the Python, i have written one code in python that read > the data from the XML file and based on the input from the xml file it > gives the output. > > Later i converted the Python script to .exe file to run on the > multiple windows server. > > The Python file is running fine when i execute script.py from the > machine where the python installed, but it gives an error when i ran > the script.exe file on the machine. Below is the error : > > *AttributeError: module object has no attribute sax* Can you show us your code? You would see that if you did this: import xml xml.sax but you would get that error just by running the script. There are come cases where py2exe does not correctly guess all of the modules it needs to include. Sometimes, you have to give it a hint. But show us what you're doing, and we will advise. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc.