[python-win32] makepy.py "Some COM library"

Steven Manross steven at manross.net
Tue May 30 14:23:49 EDT 2023


C:\Python39\Lib\site-packages\win32com\client>python -c "from win32com.client.gencache import EnsureDispatch; EnsureDispatch('ADODB.Connection.6.0');

That code seems to generate a directory in the correct path in both 3.9 and 3.11

C:\Python39\Lib\site-packages\win32com\gen_py\B691E011-1797-432E-907A-4D8C69339129x0x6x1
* With the files:
                __init__.py
                _Connection.py
                Connection.py
                ConnectionEvents.py

* Similar for 3.11 (base dir name is C:\Python311)

Also…  I’ve noticed (just now) that Python 3.9 makepy.py seems to put the constants file in the correct path…  and 3.11 doesn’t.

Test environment = Win2019 (Py3.11 – multiple systems) and Win10 (Py3.9 – one system)…  I should have some 3.10 systems here too in case that helps identify any issue(s)

HTH and let know if you want any more testing performed.  I’m always happy to help.

Steven
From: Mark Hammond <mhammond at skippinet.com.au>
Sent: Tuesday, May 30, 2023 11:01 AM
To: Steven Manross <steven at manross.net>; python-win32 at python.org
Subject: Re: [python-win32] makepy.py "Some COM library"


Does something like `python -c "from win32com.client.gencache import EnsureDispatch; EnsureDispatch('ADODB.Connection.6.0');` work? That should generate directly into the expected output directory.

Mark
On 2023-05-30 1:44 p.m., Steven Manross wrote:
Command I ran:

C:\Python311\Lib\site-packages\win32com\client>python makepy.py "ADODB.Connection.6.0"

Output:
Generating to C:\Users\someuser\AppData\Local\Temp\13\gen_py\3.11\B691E011-1797-432E-907A-4D8C69339129x0x6x1.py
Building definitions from type library...
Generating...
Importing module

---

I am running the command above, and if I do this, my Classic ASP does not see the resulting B691E011-1797-432E-907A-4D8C69339129x0x6x1.py file because it saved the file in the user temp directory as opposed to in the site-packages directory structure.


  1.  When I installed Python, I told it to install the application for “All Users” (Default Directory = C:\Program Files\Python311 -- but I removed the Program Files portion for the installation)

Is there some way to make it save the file in the correct place for the python installation from the command line so I don’t have to move the files it generates?

Keep in mind that the files it generates seems to live in a 3.11 directory, but python seems to want it in:

C:\Python311\Lib\site-packages\win32com\gen_py\B691E011-1797-432E-907A-4D8C69339129x0x6x1.py
C:\Python311\Lib\site-packages\win32com\gen_py\dicts.dat
C:\Python311\Lib\site-packages\win32com\gen_py\__init__.py

I saw the -o parameter in the makepy.py script but if I use that, it doesn’t seem to build the dicts.dat or __init__.py files – which already exist (is that a problem?).

Please and thank you for any comments,
Steven



_______________________________________________

python-win32 mailing list

python-win32 at python.org<mailto:python-win32 at python.org>

https://mail.python.org/mailman/listinfo/python-win32
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20230530/2452ac73/attachment-0001.html>


More information about the python-win32 mailing list