So I have to assume that the PYTHONPATH environment variable contains the
directory that you are trying to import from as well.
For me, we have to explicitly add another directory to our pythonpath to
ensure that all of the imports work correctly.

Perhaps try printing out os.environ from the test and the app server and see
what is different.

David

----- Original Message ----- 
From: "lloyd" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 29, 2004 3:20 PM
Subject: Re: [Webware-discuss] importing from package subdirectories fails


> Winston WOLFF wrote:
> > Could it be a permissions problem?  Does the AppServer process run as a
> > different user?
>
> yes, i run it as a different user - but i can run a test module from the
> command line when logged in as that user that has no trouble doing the
> imports...
>
>
>
> > On 29-Aug-2004, at 12:40 PM, lloyd wrote:
> >> David London wrote:
> >>
> >>> Does every subdirectory contain an __init__.py file?
> >>> As I understand things, this file is the indicator that tells webkit
> >>> there
> >>> is a module in the directory.
> >>> The file itself can be empty, or can contain whatever initialization
> >>> has to
> >>> be done for the given module.
> >>
> >>
> >> yes, there's a __init__.py file in each subdirectory.
> >>
> >> any other ideas?  this is rather frustrating...
> >>
> >>
> >>
> >>> David
> >>> ----- Original Message ----- From: "lloyd"
> >>> <[EMAIL PROTECTED]>
> >>> To: <[EMAIL PROTECTED]>
> >>> Sent: Sunday, August 29, 2004 5:09 AM
> >>> Subject: [Webware-discuss] importing from package subdirectories fails
> >>>
> >>>> webkit seems to not import packages in sys.path (ie modules in
> >>>> subdirectories).
> >>>>
> >>>> i've tried putting this directory structure in a lib/ directory:
> >>>>
> >>>>    kidney/expenses/<my modules>.py
> >>>>
> >>>> it will import from modules that are directly in the lib/ dirdectory,
> >>>> but not in the subdirectories beneath it.
> >>>>
> >>>> i've tried putting them in site-packages, with the same results.
> >>>>
> >>>> if i run an application from the command line, it works no problem.
> >>>>
> >>>> any suggestions?  (i'm using mod_webkit / apache 1.3 / debian
unstable)
> >>>>
> >>>>
> >>>> here is the Traceback:
> >>>>
> >>>> /usr/local/webapps/kidney/GetFeStmtTypes.py
> >>>>
> >>>> Traceback (most recent call last):
> >>>>   File "WebKit/Application.py", line 415, in dispatchRequest
> >>>>   File "WebKit/Application.py", line 563, in handleGoodURL
> >>>>   File "WebKit/Application.py", line 1056, in
> >>>> createServletInTransaction
> >>>>   File "WebKit/Application.py", line 990, in getServlet
> >>>>   File "WebKit/ServletFactory.py", line 183, in servletForTransaction
> >>>>   File "WebKit/ServletFactory.py", line 104, in importAsPackage
> >>>>   File "WebKit/ServletFactory.py", line 135, in
> >>>
> >>> _importModuleFromDirectory
> >>>
> >>>>   File "WebKit/ImportSpy.py", line 117, in load_module
> >>>>   File "WebKit/ImportSpy.py", line 30, in load_module
> >>>>   File "/usr/lib/python2.3/ihooks.py", line 270, in load_module
> >>>>     m = self.hooks.load_source(name, filename, file)
> >>>>   File "/usr/lib/python2.3/ihooks.py", line 168, in load_source
> >>>>     return imp.load_source(name, filename, file)
> >>>>   File "/usr/local/webapps/kidney/GetFeStmtTypes.py", line 5, in ?
> >>>>     from kidney.expenses.FeStmtType import FeStmtType
> >>>> ImportError: No module named expenses.FeStmtType
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> -------------------------------------------------------
> >>>> This SF.Net email is sponsored by BEA Weblogic Workshop
> >>>> FREE Java Enterprise J2EE developer tools!
> >>>> Get your free copy of BEA WebLogic Workshop 8.1 today.
> >>>> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> >>>> _______________________________________________
> >>>> Webware-discuss mailing list
> >>>> [EMAIL PROTECTED]
> >>>> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> >>>>
> >>
> >>
> >>
> >> -------------------------------------------------------
> >> This SF.Net email is sponsored by BEA Weblogic Workshop
> >> FREE Java Enterprise J2EE developer tools!
> >> Get your free copy of BEA WebLogic Workshop 8.1 today.
> >> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> >> _______________________________________________
> >> Webware-discuss mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> >
> >
> >
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to