[python-win32] ASP import strangeness

Brian Brown brian@assess.net
Thu, 23 Jan 2003 12:12:37 -0700


Quoting Mark Hammond <mhammond@skippinet.com.au>:

> > From command line python the following works:
> >
> >    from NutraNet.Templates import <module name>
> >
> > But from ASP it complains that it can't fine the module
> > 'Templates'. I've looked
> > at sys.modules from both enviroments and the ASP environment
> > doesn't seem to
> > pick up the nested module.
> 
> Not sure what you mean here.  For this to work, the parent directory of
> "NutraNet" must be on sys.path - is this what you see under both
> environments?
Which it is... here are the outputs of running what you suggested in both 
environment:

Python:
import sys
print sys.path
['.', 'C:\\Python22\\Scripts', 'C:\\Python22\\lib\\site-
packages\\Pythonwin', 'C:\\Python22\\lib\\site-packages\\win32', 'C:\\Python22
\\lib\\site-packages\\win32\\lib', 'C:\\Python22\\lib\\site-
packages', 'C:\\Python22\\DLLs', 'C:\\Python22\\lib', 'C:\\Python22\\lib\\lib-
tk', 'C:\\Python22', 'C:\\Python22
\\PIL', 'C:\\InetPub\\wwwroot\\AssessNet\\vr\\modules', 'C:\\Python22
\\lib\\site-
packages\\Numeric', 'C:\\InetPub\\wwwroot\\NutraNet\\modules', 'c:\\Python22
\\Lib\\site-
packages\\PyUIGui', 'c:\\cygwin\\home\\brian\\RBFoundation', 'c:\\cygwin\\home\
\brian\\RBRapier', 'c:\\cygwin\\home\\brian\\RBPrivate', 'c:\\cygwin\\home\\bri
an\\boa', 'C:\\Python22\\lib\\site-packages\\piddle']
import NutraNet
print NutraNet.__path__
['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet']
import NutraNet.Templates
print NutraNet.Templates.__path__
['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet\\Templates']


And here is ASP:
sys.path:
-----------
['C:\\Python22\\lib\\site-packages\\Pythonwin', 'C:\\Python22\\lib\\site-
packages\\win32', 'C:\\Python22\\lib\\site-packages\\win32\\lib', 'C:\\Python22
\\lib\\site-packages', 'C:\\Python22\\Lib', 'C:\\Python22\\DLLs', 'C:\\Python22
\\Lib\\lib-tk', 'C:\\WINDOWS\\system32', 'C:\\Python22', 'C:\\Python22
\\PIL', 'C:\\InetPub\\wwwroot\\AssessNet\\vr\\modules', 'C:\\Python22
\\lib\\site-
packages\\Numeric', 'C:\\InetPub\\wwwroot\\NutraNet\\modules', 'c:\\Python22
\\Lib\\site-
packages\\PyUIGui', 'C:\\cygwin\\home\\brian\\RBFoundation', 'C:\\cygwin\\home\
\brian\\RBRapier', 'C:\\cygwin\\home\\brian\\RBPrivate', 'c:\\cygwin\\home\\bri
an\\boa', 'C:\\Python22\\lib\\site-packages\\piddle']
-----------
NutraNet.__path__:
-----------
['C:\\InetPub\\wwwroot\\NutraNet\\modules\\NutraNet']


ASP throws and exception when trying to import the NutraNet.Templates, so 
above is only up to printing NutraNet.__path__

> 
> Try running:
> 
> import sys
> print sys.path
> import NutraNet
> print NutraNet.__path__
> import NutraNet.Templates
> print NutraNet.Templates__path__
> 
> under both environments.
> 
> Mark.
> 
> 
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>