OK so I got the following traceback:


# Generating comtypes.gen._7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0
# Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
Traceback (most recent call last):
  File "entities/client\MouseControl.py", line 20, in MouseControl
    tdx = CreateObject("TDxInput.Device")
  File "entities/common/Lib/site-packages\comtypes\client\__init__.py", line 
173, in CreateObject
    return _manage(obj, clsid, interface=interface)
  File "entities/common/Lib/site-packages\comtypes\client\__init__.py", line 
141, in _manage
    obj = GetBestInterface(obj)
  File "entities/common/Lib/site-packages\comtypes\client\__init__.py", line 
102, in GetBestInterface
    mod = GetModule(tlib)
  File "entities/common/Lib/site-packages\comtypes\client\_generate.py", line 
112, in GetModule
    mod = _CreateWrapper(tlib, pathname)
  File "entities/common/Lib/site-packages\comtypes\client\_generate.py", line 
175, in _CreateWrapper
    generate_module(tlib, ofi, pathname)
  File "entities/common/Lib/site-packages\comtypes\tools\tlbparser.py", line 
716, in generate_module
    gen.generate_code(items.values(), filename=pathname)
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 241, in generate_code
    self.generate_all(sorted(items, self.cmpitems))
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 183, in generate_all
    self.generate(item)
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 179, in generate
    mth(item)
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 816, in DispInterface
    self.generate(itf.get_head())
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 179, in generate
    mth(item)
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 821, in DispInterfaceHead
    self.generate(head.itf.base)
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 179, in generate
    mth(item)
  File "entities/common/Lib/site-packages\comtypes\tools\codegenerator.py", 
line 619, in External
    comtypes.client.GetModule(ext.tlib)
  File "entities/common/Lib/site-packages\comtypes\client\_generate.py", line 
112, in GetModule
    mod = _CreateWrapper(tlib, pathname)
  File "entities/common/Lib/site-packages\comtypes\client\_generate.py", line 
187, in _CreateWrapper
    mod = _my_import(fullname)
  File "entities/common/Lib/site-packages\comtypes\client\_generate.py", line 
26, in _my_import
    return __import__(fullname, globals(), locals(), ['DUMMY'])
ImportError: No module named _00020430_0000_0000_C000_000000000046_0_2_0




In my effort to find out what is going on here, I added these lines to the 
buggy method:
print "======================================"
print "_my_import(", fullname, ")"
print "comtypes.gen.__path__: ", comtypes.gen.__path__
print "======================================"




And this is the output I got from that:




======================================
_my_import( comtypes.gen._7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0 )
comtypes.gen.__path__:  [u'C:\\Dokumente und 
Einstellungen\\Mareike\\Anwendungsdaten\\Python\\Python25\\comtypes_cache']
======================================
# Generating comtypes.gen._7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0
======================================
_my_import( comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0 )
comtypes.gen.__path__:  [u'C:\\Dokumente und 
Einstellungen\\Mareike\\Anwendungsdaten\\Python\\Python25\\comtypes_cache']
======================================
# Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
======================================
_my_import( comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0 )
comtypes.gen.__path__:  [u'C:\\Dokumente und 
Einstellungen\\Mareike\\Anwendungsdaten\\Python\\Python25\\comtypes_cache']
======================================
[... the same Traceback as above here...]




The folder, that comtypes.gen.__path__ is set to, contains two files: 
_00020430_0000_0000_C000_000000000046_0_2_0.py and 
_7858B9E0_5793_4BE4_9B53_661D922790D2_0_1_0.py. So most likely the first two 
generates worked alright, and the third one now is buggy. I'm pretty new to 
Python, but I believe there is probably just a missing reference here 
somewhere, that prevents the program from finding the generated modules.



When I run the same code from the Python console, it works fine. When I copy 
the files generated from the Python console (those in C.\Python25\Lib\...\gen) 
to the same folder, that this comtypes is in, 
(C:\Programme\...\entities\common\Lib\site-packages\comtypes\gen) it works 
fine. When I copy the files generated from the Python console to the folder 
that comtypes.gen.__path__ (from the last output) is set to, it does not work.

I guess there are two possible fixes to this: Either I somehow get comtypes to 
generate the files to the folder that they work in, or I get comtypes to look 
in the folder that the files are now generated to.
_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to