Hello! Here is my dilemma. Suppose that I've got the sources to my web application in a directory called '/home/webapp'.
Inside that directory, I've got two packages: /home/webapp -> /foo -> bar.py -> /moo -> mar.py And 'mar.py' refers to some function inside 'bar.py' by doing: import foo.bar If I were using python on the command line, I could set my PYTHONPATH variable to '/home/webapp' and run 'mar.py' just fine. Now, lets say that my web application is mounted at context 'MyApp' in Webware. The import statement from above in 'mar.py' won't work now. If I change mar.py to use: import MyApp.foo.bar instead, then I can reference bar.py just fine. The problem, though, is that now when I go back to the command line with my PYTHONPATH set as above, it won't work (the import statement fails) since python will be looking for a file at: '/home/webapp/MyApp/foo/bar.py' which doesn't exist. It's a tough break for me, too, since I need to able to execute these classes from the command line for my unit testing. I've tried doing some sys.path magic inside mar.py to manually add '/home/webapp' to sys.path. That works great, but the one snag is that sometimes webware will load the same class twice. Like there will be something in sys.modules called both: 'MyApp.foo.bar', and 'foo.bar' This makes total sense, since I've introduced ambiguity into sys.path. And normally, having the classes loaded twice isn't a big deal. But I've got a number of singleton classes that will wreak havoc if loaded more than once. I suppose I could prepend 'MyApp' to every inter-package import I do, but I'd prefer to avoid hardcoding my web application context name into every class. Have any of you guys run into this sort of thing before? I was just curious about what solutions you've come up with, or if I'm going about this whole thing all wrong. :) Thanks for your time! Deepak Giridharagopal University of Texas at Austin Applied Research Laboratory ------------------------------------------------------- This sf.net email is sponsored by: Jabber - The world's fastest growing real-time communications platform! Don't just IM. Build it in! http://www.jabber.com/osdn/xim _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss