[python-win32] [Fwd: Re: Running the COM MakePy Utility from python]
Mark Hammond
skippy.hammond at gmail.com
Fri Aug 28 00:36:21 CEST 2009
Look for the win32com.client.gencache module - it exposes a number of
functions (EnsureDispatch, EnsureModule etc) designed simply to avoid
the requirement to explicitly run makepy before using an object.
Cheers,
Mark
On 27/08/2009 9:51 PM, Grant Paton-Simpson wrote:
> Hi Harald,
>
> I managed to make a file containing everything I needed. NB the command
> is makepy.py not makepy. There was, however, an issue with genpy.py
> asserting there had to be a self.file.encoding even though I couldn't
> see where that was set. I temporarily commented that assert out. File
> creation then worked. I then took out the small portion of the script I
> needed - all the data type constants - and put those in my own module.
> Success!
>
> For the benefit of others, the reason you don't have to specify the
> library e.g. ActiveX 2.8, is that you will be prompted for it via a pop
> up GUI.
>
>
> All the best, Grant
>
>
> Massa, Harald Armin wrote:
> > Grant,
> >
> > that is possible. Just read the makepy.py script within
> > win32com.client, and you will find that someway down main() there is
> >
> > ---------
> > GenerateFromTypeLibSpec(arg, f, verboseLevel = verboseLevel,
> > bForDemand = bForDemand, bBuildHidden = hiddenSpec)
> > ---------
> >
> > which does this.
> >
> > BUT, for "static" usage of makepy-COM-Mappings I suggest to make
> > makepy output it's results in a named file
> >
> > makepy -o ADO28.py
> >
> > and furtheron import that ADO28 file to access the variables. That
> > does also work with Excel and Word, and I am used to
> >
> > import ExcelXX as Excel
> > ec=Excel.constants
> >
> > and further on us ec.* for excel constants.
> >
> > Best wishes,
> >
> > HArald
> >
> > On Thu, Aug 27, 2009 at 2:51 AM, Grant Paton-Simpson <grant at p-s.co.nz
> > <mailto:grant at p-s.co.nz>> wrote:
> >
> > Hi,
> >
> > Basically I want to have an installation package automatically run the
> > COM MakePy utility for the ADO 2.8 library. I believe I need to do
> > this
> > so that constants like win32com.client.constants.adTinyInt will be
> > available when my application (http://www.sofastatistics.com)
> > connects to
> > MS Access and MS SQL Server databases.
> >
> > Ideally I would have a line doing something like this:
> >
> > win32com.runmakepy("Microsoft ActiveX Data Objects 2.8 Library (2.8)")
> >
> > Is it possible to do this programmatically?
> >
> >
> > All the best, Grant
> > _______________________________________________
> > python-win32 mailing list
> > python-win32 at python.org <mailto:python-win32 at python.org>
> > http://mail.python.org/mailman/listinfo/python-win32
> >
> >
> >
> >
> > --
> > GHUM Harald Massa
> > persuadere et programmare
> > Harald Armin Massa
> > Spielberger Straße 49
> > 70435 Stuttgart
> > 0173/9409607
> > no fx, no carrier pigeon
> > -
> > LASIK good, steroids bad?
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
More information about the python-win32
mailing list