[python-win32] SystemError: Parent module '__ax_main__' not loaded
Marc-Andre Belzile
Marc-Andre.Belzile at autodesk.com
Thu Aug 19 20:34:52 CEST 2010
>>>
-----Original Message-----
From: Mark Hammond [mailto:skippy.hammond at gmail.com]
Sent: Monday, August 16, 2010 11:40 PM
To: Marc-Andre Belzile
Cc: python-win32 at python.org
Subject: Re: [python-win32] SystemError: Parent module '__ax_main__' not loaded
On 11/08/2010 5:38 AM, Marc-Andre Belzile wrote:
> Hi,
>
> I'm using the Python ActiveX Scripting engine and I'm trying to set some
> global variables in the engine global space before parsing some .py
> files. I use this function to set the variables:
>
> def set_global_vars(fullpath ):
>
> import os
>
> globals()['__path__'] = os.path.dirname( fullpath )
>
> globals()['__file__'] = fullpath
>
> It seems to work with my python installation (py2.6/pywin 212) but some
> customers of mine have reported an error with this line below (using a
> similar installation)
>
> from win32com.client import dynamic as D
>
> # ERROR : Traceback (most recent call last):
> # File "<Script Block 2>", line 1, in <module>
> # from win32com.client import dynamic as D
> # SystemError: Parent module '__ax_main__' not loaded
>
> Obviously, if set_global_vars is skipped, the error doesn't show up.
>
> Any ideas why would this error happen ?
Probably because you are overriding __path__ and __file__ for a module,
but the module loader uses those attributes? Is it possible your client
is using a different Python version? FWIW, the
win32com.axscript.client.pyscript module is what attempts to create a
new module called __ax_main__
[mab] They are using the same version. I haven't figured what is the problem yet but renaming the two variables fixed the problem.
thanks
-mab
Mark
More information about the python-win32
mailing list