From: nikhil j. <nik...@gm...> - 2012-08-13 09:05:38
|
Here is my complete script: pastebin.com/LWUSU3cc . Its a simple text to speech app, that uses pyttsx and threading features. Now I want to package into a exe. But am having troubles with this. This is my setup.py file. #COMPILE python setup.py py2exe --includes pyttsx.drivers.sapi5 from distutils.core import setup import py2exe py2exe_options = dict( includes = "pyttsx.drivers.sapi5", typelibs = [ ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), ] ) setup(console=['speechplay.py']) I got the typelibs from gen_py folder, which looks like this: http://i.imgur.com/bnpnJ.jpg . To be honest , I have no idea what modules to include . Kindly help Thanks Nikhil |
From: Mark H. <ski...@gm...> - 2012-08-13 10:11:30
|
On 13/08/2012 7:05 PM, nikhil jain wrote: > Here is my complete script: pastebin.com/LWUSU3cc . Its a simple text to > speech app, that uses pyttsx and threading features. > > Now I want to package into a exe. But am having troubles with this. What troubles? Please be sure to reply to the list instead of just me directly! Mark > > This is my setup.py file. > > #COMPILE python setup.py py2exe --includes pyttsx.drivers.sapi5 > from distutils.core import setup > import py2exe > py2exe_options = dict( > includes = "pyttsx.drivers.sapi5", > typelibs = [ > ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > ] > ) > setup(console=['speechplay.py']) > > > I got the typelibs from gen_py folder, which looks like this: > http://i.imgur.com/bnpnJ.jpg . > To be honest , I have no idea what modules to include . > Kindly help > > Thanks > Nikhil > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users > |
From: nikhil j. <nik...@gm...> - 2012-08-13 13:28:13
|
Sorry should have mentioned. The error I get on running the the compiled exe are as follows: Exception in thread Thread-1: Traceback (most recent call last): File "threading.pyc", line 530, in __bootstrap_inner File "threading.pyc", line 483, in run File "speechplay.py", line 100, in saythread File "pyttsx\__init__.pyc", line 39, in init File "pyttsx\engine.pyc", line 45, in __init__ File "pyttsx\driver.pyc", line 66, in __init__ File "pyttsx\drivers\sapi5.pyc", line 37, in buildDriver File "pyttsx\drivers\sapi5.pyc", line 46, in __init__ File "win32com\client\__init__.pyc", line 317, in WithEvents AttributeError: 'NoneType' object has no attribute 'CLSID' On Mon, 13 Aug 2012 14:35:29 +0530, nikhil jain <nik...@gm...> wrote: > Here is my complete script: pastebin.com/LWUSU3cc . Its a simple text to > speech app, that uses pyttsx and threading features. > > Now I want to package into a exe. But am having troubles with this. > > This is my setup.py file. > > #COMPILE python setup.py py2exe --includes pyttsx.drivers.sapi5 > from distutils.core import setup > import py2exe > py2exe_options = dict( > includes = "pyttsx.drivers.sapi5", > typelibs = [ > ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > ] > ) > setup(console=['speechplay.py']) > > > I got the typelibs from gen_py folder, which looks like this: > http://i.imgur.com/bnpnJ.jpg . > To be honest , I have no idea what modules to include . > Kindly help > > Thanks > Nikhil |
From: Mark H. <ski...@gm...> - 2012-08-14 00:10:46
|
You should probably remove one of the lines in: >> typelibs = [ >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), as they are identical - although I doubt that is the source of the problem. Next, check that the C866...py file in your gen_py directory is for the COM object you think it is - you should find all the objects and methods you expect to use there. Finally, check that py2exe is doing the right thing with the typelibs - you should see a message printed regarding the typelibs when things are built, and you should be able to find the files, along with a dicts.dat, in the generated .zip file. If all else fails, try adding something like: import win32com.client.gencache print "gen path", win32com.__gen_path__ print "is zip", "win32com.client.gencache.is_zip and let me know what it says. Mark On 13/08/2012 11:28 PM, nikhil jain wrote: > Sorry should have mentioned. > The error I get on running the the compiled exe are as follows: > > Exception in thread Thread-1: > Traceback (most recent call last): > File "threading.pyc", line 530, in __bootstrap_inner > File "threading.pyc", line 483, in run > File "speechplay.py", line 100, in saythread > File "pyttsx\__init__.pyc", line 39, in init > File "pyttsx\engine.pyc", line 45, in __init__ > File "pyttsx\driver.pyc", line 66, in __init__ > File "pyttsx\drivers\sapi5.pyc", line 37, in buildDriver > File "pyttsx\drivers\sapi5.pyc", line 46, in __init__ > File "win32com\client\__init__.pyc", line 317, in WithEvents > AttributeError: 'NoneType' object has no attribute 'CLSID' > > > > > On Mon, 13 Aug 2012 14:35:29 +0530, nikhil jain <nik...@gm...> wrote: > >> Here is my complete script: pastebin.com/LWUSU3cc . Its a simple text to >> speech app, that uses pyttsx and threading features. >> >> Now I want to package into a exe. But am having troubles with this. >> >> This is my setup.py file. >> >> #COMPILE python setup.py py2exe --includes pyttsx.drivers.sapi5 >> from distutils.core import setup >> import py2exe >> py2exe_options = dict( >> includes = "pyttsx.drivers.sapi5", >> typelibs = [ >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >> ] >> ) >> setup(console=['speechplay.py']) >> >> >> I got the typelibs from gen_py folder, which looks like this: >> http://i.imgur.com/bnpnJ.jpg . >> To be honest , I have no idea what modules to include . >> Kindly help >> >> Thanks >> Nikhil > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users > |
From: nikhil j. <nik...@gm...> - 2012-08-14 11:52:28
|
Thanks for helping me Mark, but I am not able to understand much here :(. On Tue, 14 Aug 2012 05:40:35 +0530, Mark Hammond <ski...@gm...> wrote: > You should probably remove one of the lines in: > > >> typelibs = [ > >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > > as they are identical - although I doubt that is the source of the > problem. Next, check that the C866...py file in your gen_py directory > is for the COM object you think it is - you should find all the objects > and methods you expect to use there. Finally, check that py2exe is > doing the right thing with the typelibs - you should see a message > printed regarding the typelibs when things are built, and you should be > able to find the files, along with a dicts.dat, in the generated .zip > file. > > If all else fails, try adding something like: > > import win32com.client.gencache > print "gen path", win32com.__gen_path__ > print "is zip", "win32com.client.gencache.is_zip > > and let me know what it says. > > Mark > > On 13/08/2012 11:28 PM, nikhil jain wrote: >> Sorry should have mentioned. >> The error I get on running the the compiled exe are as follows: >> >> Exception in thread Thread-1: >> Traceback (most recent call last): >> File "threading.pyc", line 530, in __bootstrap_inner >> File "threading.pyc", line 483, in run >> File "speechplay.py", line 100, in saythread >> File "pyttsx\__init__.pyc", line 39, in init >> File "pyttsx\engine.pyc", line 45, in __init__ >> File "pyttsx\driver.pyc", line 66, in __init__ >> File "pyttsx\drivers\sapi5.pyc", line 37, in buildDriver >> File "pyttsx\drivers\sapi5.pyc", line 46, in __init__ >> File "win32com\client\__init__.pyc", line 317, in WithEvents >> AttributeError: 'NoneType' object has no attribute 'CLSID' >> >> >> >> >> On Mon, 13 Aug 2012 14:35:29 +0530, nikhil jain <nik...@gm...> >> wrote: >> >>> Here is my complete script: pastebin.com/LWUSU3cc . Its a simple text >>> to >>> speech app, that uses pyttsx and threading features. >>> >>> Now I want to package into a exe. But am having troubles with this. >>> >>> This is my setup.py file. >>> >>> #COMPILE python setup.py py2exe --includes pyttsx.drivers.sapi5 >>> from distutils.core import setup >>> import py2exe >>> py2exe_options = dict( >>> includes = "pyttsx.drivers.sapi5", >>> typelibs = [ >>> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >>> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >>> ] >>> ) >>> setup(console=['speechplay.py']) >>> >>> >>> I got the typelibs from gen_py folder, which looks like this: >>> http://i.imgur.com/bnpnJ.jpg . >>> To be honest , I have no idea what modules to include . >>> Kindly help >>> >>> Thanks >>> Nikhil >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. >> Discussions >> will include endpoint security, mobile security and the latest in >> malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Py2exe-users mailing list >> Py2...@li... >> https://lists.sourceforge.net/lists/listinfo/py2exe-users >> |
From: Fox, M. K <mic...@bo...> - 2012-08-14 16:08:26
|
Nikhil: If you are going to call COM objects with the Python language you are probably going to need to read the book "Python Programming On Win32" by Mark Hammond. But here's a short summary: Dynamic Linked Libraries (DLLs) that contain COM interfaces are each given a "universally unique identifier" (UUID). When you use pywin32 to call a COM object it finds the TypeLib for the DLL, reads it, and creates a Python wrapper that allows Python to instantiate the class in the DLL and call the methods of that class, even though the DLL is written in some other language such as C++. The Python wrapper is written into a directory on your hard drive at C:/Python27/Lib/site-packages/win32com/gen_py/ That's why Mark suggested you should look in your gen_py folder. As long as you are running your source code on your own PC it looks for the wrappers in your gen_py folder. But when you package your application with py2exe you must send the gen_py wrapper(s) with your application so your user will have access to it. The three lines in your setup.py file typelibs = [ ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), tell py2exe to look in the gen_py folder for a wrapper whose file name will be C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x0.py and package it in the library.zip file it creates and distributes with your application. In his reply to you, Mark is suggesting that you look in C:/Python27/Lib/site-packages/win32com/gen_py/ and find the wrapper that corresponds to the DLL you are trying to call. You might have several wrapper files in there but the wrappers are plain text so you can open them and look at their contents to see which one contains the name of the class you are trying to instantiate. Mike Fox -----Original Message----- From: nikhil jain [mailto:nik...@gm...] Sent: Tuesday, August 14, 2012 4:52 AM To: py2...@li... Subject: Re: [Py2exe-users] Need help with compiling pyttsx module Thanks for helping me Mark, but I am not able to understand much here :(. On Tue, 14 Aug 2012 05:40:35 +0530, Mark Hammond <ski...@gm...> wrote: > You should probably remove one of the lines in: > > >> typelibs = [ > >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > >> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), > > as they are identical - although I doubt that is the source of the > problem. Next, check that the C866...py file in your gen_py directory > is for the COM object you think it is - you should find all the > objects and methods you expect to use there. Finally, check that > py2exe is doing the right thing with the typelibs - you should see a > message printed regarding the typelibs when things are built, and you > should be able to find the files, along with a dicts.dat, in the > generated .zip file. > > If all else fails, try adding something like: > > import win32com.client.gencache > print "gen path", win32com.__gen_path__ print "is zip", > "win32com.client.gencache.is_zip > > and let me know what it says. > > Mark > > On 13/08/2012 11:28 PM, nikhil jain wrote: >> Sorry should have mentioned. >> The error I get on running the the compiled exe are as follows: >> >> Exception in thread Thread-1: >> Traceback (most recent call last): >> File "threading.pyc", line 530, in __bootstrap_inner >> File "threading.pyc", line 483, in run >> File "speechplay.py", line 100, in saythread >> File "pyttsx\__init__.pyc", line 39, in init >> File "pyttsx\engine.pyc", line 45, in __init__ >> File "pyttsx\driver.pyc", line 66, in __init__ >> File "pyttsx\drivers\sapi5.pyc", line 37, in buildDriver >> File "pyttsx\drivers\sapi5.pyc", line 46, in __init__ >> File "win32com\client\__init__.pyc", line 317, in WithEvents >> AttributeError: 'NoneType' object has no attribute 'CLSID' >> >> >> >> >> On Mon, 13 Aug 2012 14:35:29 +0530, nikhil jain <nik...@gm...> >> wrote: >> >>> Here is my complete script: pastebin.com/LWUSU3cc . Its a simple >>> text to speech app, that uses pyttsx and threading features. >>> >>> Now I want to package into a exe. But am having troubles with this. >>> >>> This is my setup.py file. >>> >>> #COMPILE python setup.py py2exe --includes pyttsx.drivers.sapi5 >>> from distutils.core import setup >>> import py2exe >>> py2exe_options = dict( >>> includes = "pyttsx.drivers.sapi5", >>> typelibs = [ >>> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >>> ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 0), >>> ] >>> ) >>> setup(console=['speechplay.py']) >>> >>> >>> I got the typelibs from gen_py folder, which looks like this: >>> http://i.imgur.com/bnpnJ.jpg . >>> To be honest , I have no idea what modules to include . >>> Kindly help >>> >>> Thanks >>> Nikhil >> >> --------------------------------------------------------------------- >> --------- >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. >> Discussions >> will include endpoint security, mobile security and the latest in >> malware threats. >> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Py2exe-users mailing list >> Py2...@li... >> https://lists.sourceforge.net/lists/listinfo/py2exe-users >> ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Py2exe-users mailing list Py2...@li... https://lists.sourceforge.net/lists/listinfo/py2exe-users |