On Aug 9, 2009, at 1:49 AM, Bottiger wrote: > > Massimo, it is in the path because above there is the following line: > > sys.path.append('applications/%s/modules' % request.application) > > And it does work if you first request a page from "provider" before > using the "cas" application, so its definately a timing issue rather > than a path/import issue.
Use an absolute path, maybe? Can the cwd change? And test sys.path to make sure it's not there. Still not 100% thread- safe, but as a practical matter not much risk > > On Aug 9, 1:03 am, mdipierro <mdipie...@cs.depaul.edu> wrote: >> I think, this should not work >> >> from w2popenid import Web2pyFetcher >> >> because w2popenid is not in path. Twy >> >> exec('from applications.%s.modules.w2popenid import Web2pyFetcher' % >> request.application) >> >> On Aug 9, 2:12 am, Bottiger <bottig...@gmail.com> wrote: >> >>> I have been trying to create an OpenID version of Auth. >> >>> I stumbled upon a very puzzling behavior that I think may be an >>> underlying consequence of using exec. I do not know for sure though >>> because the bug is very strange. >> >>> First the setup. I am using hcvst's openid provider so I can test >>> locally. >> >>> However, if I try to use it by using the OpenID >>> auth:http://127.0.0.1:8000/cas/default/user/login >> >>> then the provider address:http://127.0.0.1:8000/provider/openid/id/test >> >>> will complain: >> >>> File "C:/Users/admin/Desktop/web2py/applications/provider/ >>> controllers/openid.py", line 7, in <module> >>> from w2popenid import Web2pyFetcher >>> ImportError: cannot import name Web2pyFetcher >> >>> Obviously, w2popenid does exist, and Web2pyFetcher is in the file >>> but >>> web2py chokes! But then I figured out if I restarted the server and >>> then first visited: >> >>> http://127.0.0.1:8000/provider/openid/id/test >> >>> Then it worked just fine! >> >>> So I am wondering if anyone can explain this bizarre behavior. >> >>> Note: the "cas" application version of w2popenid does not have a >>> Web2pyFetcher but the "provider" one does. This does not excuse >>> Web2Py >>> though. >> >>> Source Code:http://www.codexon.com/temp/bug.zip > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---