[python-win32] Import issue in pyscript

Mark Hammond skippy.hammond at gmail.com
Tue Dec 14 20:08:43 CET 2010


On 13/12/2010 7:49 AM, Erik Oosterwaal wrote:
> The contents of the two simple files I used to test this is below. I get
> the following error:
>
> Python ActiveX Scripting Engine error '80020009'
>
> Traceback (most recent call last): File "<Script Block >", line 6, in
> <module> from pythonwsc import justtesting ImportError: cannot import
> name justtesting
>
> /tools/erik/pytest.asp, line 8
>
> from pythonwsc import justtesting
>
> Can anyone explain why this gives me this error

It gives an error as Python isn't able to import the model pythonwsc - 
probably because pythonwsc.py isn't on sys.path.  Note that sys.path 
doesn't include the directory where a .asp file lives - you probably 
need to manually add this path to sys.path - either explicitly in code, 
via a global PYTHONPATH env var, or via the registry.

> and if it is at all
> possible to call a Python method with a leading classname like
> justtesting.list_builtins() from vbscript ?

Nope - win32com doesn't know how to return module objects to vbscript, 
which would be required for this to work.

Cheers,

Mark


More information about the python-win32 mailing list