Hello Ron,
thanks for your help. Yes i know this exactly can cause problem like that,
but i am sure that i did not do such schollar mistake.
Actulaly as i mentioned i have this problem with INN python_auth hook. I was
doing a lot of experiments last days and i found that problem is on their
side.
Simply in nnrpd_auth.py script ---> which is called by INN news server when
doing authentication & access thinks ... have problems with importing
anything except python built-in modules.
So my only one possibility how to accomplish was simple to make a python
script which is using python module and will work on commandline (use
arguments username and password and replies to standart out result). Then in
nnrpd_auth import sys and simply call that as a external program and script
with popen and read the result. With such a simple trick i have avoid need
to use import ldap in nnrpd_auth.py directly. I am not satisfied with that
solution, becouse it looks really lame, but unfortunately there is no other
solution i hope - as no one on INN mailinglist was not able to answer me
with the solution.
Thanks,
David
2008/6/6 Ron Teitelbaum <[EMAIL PROTECTED]>:
> Hi David,
>
>
>
> I had this happen before because I tried to do this:
>
>
>
> Import aModuleName.py
>
>
>
> I don't see that mistake in your code though, but maybe something you are
> calling is doing that. You need to leave off the .py when doing import.
>
>
>
> Hope that helps,
>
>
>
> Ron
>
>
> ------------------------------
>
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *David Hlácik
> *Sent:* Thursday, June 05, 2008 9:55 AM
> *To:* python-ldap-dev@lists.sourceforge.net
> *Subject:* Re: module ldap : no module named .py
>
>
>
> As you can see :
> Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py
> comes from nnrpd_auth.py :
>
> try:
> if
> self.__newsauth(str(attributes['user']),str(attributes['pass'])):
> syslog('notice', 'authentication by username
> succeeded')
> return ( self.authcodes['ALLOWED'], 'No error',
> 'default_user')
> else:
> syslog('notice', 'authentication by username
> failed')
> return ( self.authcodes['DENIED'], 'Access
> Denied!')
> except Exception, e:
> syslog('notice', "Error: %s" % e)
>
> On Thu, Jun 5, 2008 at 3:53 PM, David Hláčik <[EMAIL PROTECTED]> wrote:
>
> FYI,
>
> this is the result of test.py :
> -- syslog level: notice message: nnrpd authentication class instance
> created
> ** set_auth_hook for <nnrpd_auth.AUTH instance at 0xb7f1f5ec>
> -- syslog level: notice message: authentication module successfully hooked
> into nnrpd
> -- syslog level: notice message: nnrpd authentication class instance
> created
> -- syslog level: notice message: n_a authenticate() invoked: hostname None,
> ipaddress None, interface None, user boss
> -- syslog level: notice message: authentication by username succeeded
> (281, 'No error', 'default_user')
>
> And this is the result (from news.notice) when used as auth hook in INN :
> (inn will load nnrpd_auth.py and instantiate as in nnrpd_auth.py on the end
> written and call method authenticate(attributes) ) :
>
> Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu (10.10.10.199)
> connect
> Jun 5 13:33:12 dev01 nnrpd[9550]: python interpreter initialized OK
> Jun 5 13:33:12 dev01 nnrpd[9550]: python: nnrpd authentication class
> instance created
> Jun 5 13:33:12 dev01 nnrpd[9550]: python: authentication module
> successfully hooked into nnrpd
> Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_init not found
> Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_close not found
> Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_init not found
> Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_close not found
> Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_init not found
> Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_close not found
> Jun 5 13:33:12 dev01 nnrpd[9550]: python: n_a authenticate() invoked:
> hostname david-nb.net.hlacik.eu, ipaddress 10.10.10.199, interface
> 10.10.10.183, user boss
> Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py
> Jun 5 13:33:12 dev01 nnrpd[9550]: python authenticate method returned
> wrong result
> Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu times user 0.016
> system 0.016 idle 0.000 elapsed 0.073
>
>
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev