You can add any path you want to the registry, and it will work from ASP. You can use the Pythonwin's "Tools->Edit Python Path" to add a new entry - simply add a new key under PythonPath (naming it whatever you like), and add your paths as a value to the key. There is no reasonable way for the ActiveScripting engine to automatically do this - ASP is just one of many ActiveScripting environments, and it has no special ASP knowledge. Further, we can not add the "current script directory" to the path, as ASP never passes a file name, but a block of text with the script code. Mark. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Robert > Melton > Sent: Wednesday, 13 June 2001 2:48 PM > To: [EMAIL PROTECTED] > Subject: Re: Import Issues with Active Server Pages and ActivePython > > > Update: > After a reboot using code like this did work: > > ==== > import os, sys, imp > > if (sys.path.count(Server.MapPath('.')) == 0): > sys.path.append(Server.MapPath('.')) > > import mymodule > ==== > > But I am still looking for a better way to do this., that just > seems ugly. > > On Wednesday 13 June 2001 12:33 am, Robert Melton wrote: > > I have my own python module in: > > c:\inetpub\wwwroot\myapp\mymodule.py > > > > I have an asp file in the same directory: > > c:\inetpub\wwwroot\myapp\myaspfile.asp > > > > 'myaspfile.asp' imports mymodule at the top of the file, but > can not find > > it. The reason it can't find it is because the directory the > python script > > was run from is c:\winnt\system32(via the asp dll), and the > module is not > > there, nor is the module in any of the other sys.path directories. > > > > This isn't horrible, because sys.path is a normal list, you can > just append > > the current directory to the end, using something like this: > > sys.path.append(Server.MapPath('.')) #not lovely but works > > > > then in theory after you have the current directory in the sys.path, you > > should be able to 'import mymodule' just fine, but case and point I can > > not. > > > > Any advice/hints/other would be great, this is driving me up the wall. > > > > --Robert > _______________________________________________ > ActivePython mailing list > [EMAIL PROTECTED] > http://listserv.ActiveState.com/mailman/listinfo/activepython _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/activepython
